﻿namespace = orgy_main_mysterious_energy

############################
# Mysterious Energy
# by CashinCheckin
############################

# You are empowered by a mysterious energy that causes you to go to far
	# You are fucking a promising Mulsa when you become empowered by a magical energy that fills the room.
		#Take it slow
		# Relish in the power and pickup the pace
			# Stop v1 (good)
				#She is relieved
			# Stop v2 (bad)
				#She is hurt
			# Perhaps I can share some of this power with her v1 (good)
				#Mindblowing sex
			#Perhaps I can share some of this power with her v2 (bad)
				#Unsatisfying sex
			# Ignore her pleas and rut her hard v1 (she dies)
				#She dies
			# Ignore her pleas and rut her hard v1 (she absorbs the power)
				#She absorbs the power and become stronger
		
####
# Weight and Setup Event
####
orgy_main_mysterious_energy.0001 = {
	type = activity_event
	hidden = yes

	trigger = {
		# Make sure this wasn't triggered last time
		trigger_if = {
			limit = { scope:activity.activity_host = { has_variable = last_orgy_was } }
			NOT = { scope:activity.activity_host.var:last_orgy_was = flag:mysterious_energy }
		}
		# Need at least 1 Paelex to be in attendance or else localization breaks
		scope:activity = {
			any_attending_character = {
				is_regula_leader_devoted_trigger = yes
			}
		}
	}

	immediate = {
		scope:activity = {
			activity_host = {
				# Set this as last main orgy activity
				set_variable = {
					name = last_orgy_was
					value = flag:mysterious_energy
				}
				trigger_event = orgy_main_mysterious_energy.0002
			}
		}
	}
}

###
# Event for Host (Magister)
###
# Intro Event
orgy_main_mysterious_energy.0002 = {
	type = activity_event
	title = orgy_main_mysterious_energy.0002.t
	desc = orgy_main_mysterious_energy.0002.desc

	theme = regula_orgy_theme
	override_background = {
		reference = bedchamber
	}

	right_portrait = {
		character = scope:mulsa
		animation = personality_content
	}
	
	center_portrait = {
		character = scope:host
		animation = stress
	}

	immediate = {
		# Grab Mulsa
		scope:activity = {
			random_attending_character = {
				limit = {
					has_trait = mulsa
					age >= 18
					age <= 21
				}
				save_scope_as = mulsa
			}
			if = {
				limit = { NOT = { exists = scope:mulsa } }
				create_character = {
					location = scope:host.location
					culture = scope:host.culture
					faith = scope:host.faith
					template = regula_orgy_ambitious_mulsa
					save_scope_as = mulsa
				}
				hidden_effect = {
					if = {
						limit = {
							has_game_rule = carn_dt_tits_small_good
							has_game_rule = carn_dt_enabled
						}
						scope:mulsa = {
						add_trait = tits_small_good_2
						}
					}
					else_if = {
						limit = {
							has_game_rule = carn_dt_tits_small_bad
							has_game_rule = carn_dt_enabled
						}
						scope:mulsa = {
							add_trait = tits_small_bad_2
						}
					}

					scope:host = { add_courtier = scope:mulsa }
					scope:mulsa = { add_to_activity = scope:activity }
				}
			}
		}

		# Grab Paelex
		scope:activity = {
			random_attending_character = {
				limit = {
					is_regula_leader_devoted_trigger = yes
				}
				save_scope_as = waiting_paelex
			}
		}

		# Set Naked
		scope:mulsa = {
			add_character_flag = {
				flag = is_naked
				days = 1
			}
		}
		scope:host = {
			add_character_flag = {
				flag = is_naked
				days = 1
			}
		}
	}

	# Begin to fuck her
	option = {
		name = orgy_main_mysterious_energy.0002.a

		trigger_event = orgy_main_mysterious_energy.1000
	}
}

##########################################################
# Begin to fuck her
orgy_main_mysterious_energy.1000 = {
	type = activity_event
	title = orgy_main_mysterious_energy.1000.t
	desc = orgy_main_mysterious_energy.1000.desc

	theme = regula_orgy_theme
	override_background = {
		reference = bedchamber
	}

	right_portrait = {
		character = scope:mulsa
		animation = paranoia
	}

	center_portrait = {
		character = scope:host
		animation = ecstasy
	}

	#continue to take it slow
	option = {
		name = orgy_main_mysterious_energy.1000.a
		trigger_event = orgy_main_mysterious_energy.1100
	}
	
	#relish in the energy and pick up the pace
	option = {
		name = orgy_main_mysterious_energy.1000.b
		trigger_event = orgy_main_mysterious_energy.1300
		}
}
# continue to take it slow
orgy_main_mysterious_energy.1100 = {
	type = activity_event
	title = orgy_main_mysterious_energy.1100.t
	desc = orgy_main_mysterious_energy.1100.desc

	theme = regula_orgy_theme
	override_background = {
		reference = bedchamber
	}

	center_portrait = {
		character = scope:host
		animation = happiness
	}

	right_portrait = {
		character = scope:mulsa
		animation = love
	}

	option = {
		name = orgy_main_mysterious_energy.1100.a
		trigger_event = orgy_main_mysterious_energy.1300
	}
}

# relish in the energy and pick up the pace
orgy_main_mysterious_energy.1300 = {
	type = activity_event
	title = orgy_main_mysterious_energy.1000.t
	desc = orgy_main_mysterious_energy.1300.desc
	
	theme = regula_orgy_theme
	override_background = {
		reference = bedchamber
	}

	center_portrait = {
		character = scope:host
		animation = ecstasy
	}

	right_portrait = {
		character = scope:mulsa
		animation = pain
	}

	# Stop before she get seriously hurt
	option = {
		name = orgy_main_mysterious_energy.1300.a
		random_list = {
			50 = {
				add_prestige = medium_prestige_gain			
				scope:mulsa = {
					add_opinion = {
						modifier = regula_orgy_main_mysterious_energy_spared
						target = scope:host
					}
					add_stress = medium_stress_loss
				}
				trigger_event = orgy_main_mysterious_energy.1400
			}
			50 = {
				add_prestige = medium_prestige_loss
				scope:mulsa = { 
					add_opinion = {
						modifier = regula_orgy_main_mysterious_energy_hurt
						target  = scope:host
					}
					add_stress = medium_stress_gain
					add_trait = wounded_1
				}
				trigger_event = orgy_main_mysterious_energy.1500
			}
		}
	}
	
	# Perhaps I can share some of this power with her
	option = {
		name = orgy_main_mysterious_energy.1300.b
		duel = {
			skill = learning
			target = scope:mulsa
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = orgy_main_mysterious_energy.1300.b.success
				trigger_event = orgy_main_mysterious_energy.1600
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = orgy_main_mysterious_energy.1300.b.fail
				trigger_event = orgy_main_mysterious_energy.1700
			}
		}
	}
	
	# Ignore her pleas and rut her hard
	option = {
		name = orgy_main_mysterious_energy.1300.c
		duel = {
			skill = prowess
			target = scope:mulsa
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = orgy_main_mysterious_energy.1300.c.success
				trigger_event = orgy_main_mysterious_energy.1800
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = orgy_main_mysterious_energy.1300.c.fail
				trigger_event = orgy_main_mysterious_energy.1900
			}
		}
	}		
}

# Stop v1 (good)
orgy_main_mysterious_energy.1400 = {
	type = activity_event
	title = orgy_main_mysterious_energy.1400.t
	desc = orgy_main_mysterious_energy.1400.desc

	theme = regula_orgy_theme
	override_background = {
		reference = bedchamber
	}

	center_portrait = {
		character = scope:host
		animation = stress
	}

	right_portrait = {
		character = scope:mulsa
		animation = disbelief
	}
	
	left_portrait = {
		character = scope:waiting_paelex
	}

	option = {
		name = orgy_main_mysterious_energy.1400.a
	}
	
	after = {
		hidden_effect = {
 			scope:activity = {
				add_activity_log_entry = {
					key = regula_orgy_mysterious_energy_log_a
					tags = { good }
					score = 25
					character = scope:host
					target = scope:mulsa
				}
			}
		}
	}
}

# Stop v2 (bad)
orgy_main_mysterious_energy.1500 = {
	type = activity_event
	title = orgy_main_mysterious_energy.1500.t
	desc = orgy_main_mysterious_energy.1500.desc

	theme = regula_orgy_theme
	override_background = {
		reference = bedchamber
	}

	center_portrait = {
		character = scope:host
		animation = stress
	}

	right_portrait = {
		character = scope:mulsa
		animation = grief
	}

	option = {
		name = orgy_main_mysterious_energy.1500.a
	}
	
	after = {
		hidden_effect = {
 			scope:activity = {
				add_activity_log_entry = {
					key = regula_orgy_mysterious_energy_log_b
					tags = { bad }
					score = 25
					character = scope:host
					target = scope:mulsa
				}
			}
		}
	}
}

# Perhaps I can share some of this power with her v1 (good)
orgy_main_mysterious_energy.1600 = {
	type = activity_event
	title = orgy_main_mysterious_energy.1600.t
	desc = orgy_main_mysterious_energy.1600.desc

	theme = regula_orgy_theme
	override_background = {
		reference = bedchamber
	}

	center_portrait = {
		character = scope:host
		animation = ecstasy
	}

	right_portrait = {
		character = scope:mulsa
		animation = love
	}
	
	after = {
		hidden_effect = {
 			scope:activity = {
				add_activity_log_entry = {
					key = regula_orgy_mysterious_energy_log_c
					tags = { good }
					score = 25
					character = scope:host
					target = scope:mulsa
				}
			}
		}
	}
	
	option = {
		name = orgy_main_mysterious_energy.1600.a
		scope:host = {
			stress_impact = {
				gregarious = medium_stress_loss
				content = medium_stress_loss
				patient = medium_stress_loss
				zealous = minor_stress_loss
				impatient = minor_stress_loss
			}
			add_piety = medium_piety_gain
			add_prestige = medium_prestige_gain
		}
		scope:mulsa = {
			stress_impact = {
				ambitious = massive_stress_loss
				arrogant = medium_stress_loss
			}
			add_prestige = massive_prestige_gain
		}
		hidden_effect = {
			scope:host = {
				if = {
					limit = {
						piety_level = 0
					}
					scope:mulsa = {
						make_pregnant = {
							father = scope:host
							number_of_children = 1
						}
					}
				}
				if = {
					limit = {
						piety_level = 1
					}
					scope:mulsa = {
						random_list = {
							75 = {
								make_pregnant = {
									father = scope:host
									number_of_children = 1
								}
							}
							25 = {
								make_pregnant = {
									father = scope:host
									number_of_children = 2
								}
							}
						}
					}
				}
				if = {
					limit = {
						piety_level = 2
					}
					scope:mulsa = {
						random_list = {
							60 = {
								make_pregnant = {
									father = scope:host
									number_of_children = 1
								}
							}
							40 = {
								make_pregnant = {
									father = scope:host
									number_of_children = 2
								}
							}
						}
					}
				}
				if = {
					limit = {
						piety_level = 3
					}
					scope:mulsa = {
						random_list = {
							75 = {
								make_pregnant = {
									father = scope:host
									number_of_children = 2
								}
							}
							25 = {
								make_pregnant = {
									father = scope:host
									number_of_children = 3
								}
							}
						}
					}
				}
				if = {
					limit = {
						piety_level = 4
					}
					scope:mulsa = {
						random_list = {
							60 = {
								make_pregnant = {
									father = scope:host
									number_of_children = 2
								}
							}
							40 = {
								make_pregnant = {
									father = scope:host
									number_of_children = 3
								}
							}
						}
					}
				}
				if = {
					limit = {
						piety_level = 5
					}
					scope:mulsa = {
						random_list = {
							75 = {
								make_pregnant = {
									father = scope:host
									number_of_children = 3
								}
							}
							25 = {
								make_pregnant = {
									father = scope:host
									number_of_children = 4
								}
							}
						}
					}
				}
			}
		}
	}		
}

# Perhaps I can share some of this power with her v2 (bad)
orgy_main_mysterious_energy.1700 = {
	type = activity_event
	title = orgy_main_mysterious_energy.1700.t
	desc = orgy_main_mysterious_energy.1700.desc

	theme = regula_orgy_theme
	override_background = {
		reference = bedchamber
	}

	center_portrait = {
		character = scope:host
		animation = rage
	}

	right_portrait = {
		character = scope:mulsa
		animation = sadness
	}
	
	after = {
		hidden_effect = {
 			scope:activity = {
				add_activity_log_entry = {
					key = regula_orgy_mysterious_energy_log_d
					tags = { bad }
					score = 25
					character = scope:host
					target = scope:mulsa
				}
			}
		}
	}
	
	option = {
		name = orgy_main_mysterious_energy.1700.a
		scope:host = {
			stress_impact = {
				vengeful = minor_stress_loss
				impatient = minor_stress_loss
				cynical = minor_stress_loss
				wrathful = minor_stress_loss
				forgiving = major_stress_gain
				patient = medium_stress_gain
				zealous = medium_stress_gain
				calm = medium_stress_gain
			}
			add_piety = medium_piety_loss
			add_prestige = medium_prestige_loss
		}
		
		scope:mulsa = {
			if = {
				limit = {
					OR = {
						has_trait = ambitious
						has_trait = arrogant
						has_trait = humble
						has_trait = content
					}
				}					
				stress_impact = {
					ambitious = massive_stress_gain
					arrogant = medium_stress_gain
					humble = medium_stress_loss
					content = medium_stress_loss
				}
			}
			else = {
				add_stress = medium_stress_gain
			}
		}
		
		scope:mulsa = {
			add_prestige = minor_prestige_loss
			add_dread = medium_dread_loss
			add_opinion = {
				modifier = regula_orgy_main_mysterious_energy_hurt
				target  = scope:host
			}
			remove_from_activity = scope:activity
		}
		
		hidden_effect = {
			regula_sex_with_target_no_stress = { TARGET = scope:mulsa }
		}
	}
}

# Ignore her pleas and rut her hard v1 (she dies)
orgy_main_mysterious_energy.1800 = {
	type = activity_event
	title = orgy_main_mysterious_energy.1800.t
	desc = orgy_main_mysterious_energy.1800.desc

	theme = regula_orgy_theme
	override_background = {
		reference = bedchamber
	}

	center_portrait = {
		character = scope:host
		animation = ecstasy
	}

	right_portrait = {
		character = scope:mulsa
		animation = dead
	}
	
	left_portrait = {
		character = scope:waiting_paelex
		outfit_tags = { no_cloak no_hat no_pants no_clothes }
	}
	
	immediate = {
		play_music_cue = mx_cue_death
	}
	
	after = {
		hidden_effect = {
 			scope:activity = {
				add_activity_log_entry = {
					key = regula_orgy_mysterious_energy_log_e
					tags = { good }
					score = 25
					character = scope:host
					target = scope:mulsa
				}
			}
		}
	}

	option = {
		name = orgy_main_mysterious_energy.1800.a
		scope:mulsa = {
			death = {
				death_reason = death_fucked_known
				killer = scope:host
			}
		}
		scope:host = {
			stress_impact = {
				sadistic = massive_stress_loss
				callous = major_stress_loss
				zealous = major_stress_loss
				arrogant = medium_stress_loss
				greedy = medium_stress_loss
				wrathful = medium_stress_loss
				compassionate = major_stress_gain
				content = medium_stress_gain
				forgiving = medium_stress_gain
				
			}
			add_prestige = minor_prestige_loss
			add_piety = minor_piety_loss
			add_dread = major_dread_gain
		}
	}
}

# Ignore her pleas and rut her hard v2 (she absorbs the power)
orgy_main_mysterious_energy.1900 = {
	type = activity_event
	title = orgy_main_mysterious_energy.1900.t
	desc = orgy_main_mysterious_energy.1900.desc

	theme = regula_orgy_theme
	override_background = {
		reference = bedchamber
	}

	center_portrait = {
		character = scope:host
		animation = shock
	}

	right_portrait = {
		character = scope:mulsa
		animation = war_attacker
	}
	
	after = {
		hidden_effect = {
 			scope:activity = {
				add_activity_log_entry = {
					key = regula_orgy_mysterious_energy_log_f
					tags = { bad }
					score = 25
					character = scope:host
					target = scope:mulsa
				}
			}
		}
	}
	
	option = {
		name = orgy_main_mysterious_energy.1900.a

		
		scope:host = {
			regula_sex_with_target_normal_outside = { TARGET = scope:mulsa }
		}

		scope:host = {
			stress_impact = {
				arrogant = major_stress_gain
				sadistic = medium_stress_gain
			}
			if = {
				limit = {
					OR = {
						has_trait = sadistic
						has_trait = arrogant
					}
				}
				add_prestige = major_prestige_loss
				add_dread = medium_dread_loss
			}
			else = {
				add_prestige = medium_prestige_loss
				add_dread = minor_dread_loss
			}
		}	
		scope:mulsa = {
			stress_impact = {
				ambitious = massive_stress_loss
				sadistic = major_stress_loss
				arrogant = medium_stress_loss
			}
			if = {
				limit = {
					OR = {
						has_trait = physique_good_1
						has_trait = physique_good_2
					}
				}
				regula_rank_up_physical_trait_effect = yes
			}
			else_if = {
				limit = {
					has_trait = physique_good_3
				}
				add_trait = strong
			}
			else_if = {
				limit = {
					OR = {
						has_trait = physique_bad_1
						has_trait = physique_bad_2
						has_trait = physique_bad_3
					}
				}
				remove_trait = physique_bad_1
				remove_trait = physique_bad_2
				remove_trait = physique_bad_3
				add_trait = physique_good_1
			}
			else = {
				random_list = {
					60 = { add_trait = physique_good_1 }
					30 = { add_trait = physique_good_2 }
					10 = { add_trait = physique_good_3 }
				}
			}
		}
		scope:mulsa = {
			if = {
				limit = {
					OR = {
						has_trait = ambitious
						has_trait = sadistic
						has_trait = arrogant
					}
				}
				add_prestige = major_prestige_gain
				add_dread = medium_dread_gain
			}
			else = {
				add_prestige = medium_prestige_gain
				add_dread = minor_dread_gain
			}
		}
		hidden_effect = {
			random_list = {
				30 = {
					make_pregnant = {
						father = scope:host
						number_of_children = 3
					}
				}
				40 = {
					make_pregnant = {
						father = scope:host
						number_of_children = 2
					}
				}
				20 = {
					make_pregnant = {
						father = scope:host
						number_of_children = 1
					}
				}
				10 = {}
			}
		}
	}
}