﻿namespace = regula_orgy_guest

##################################################
# "Guest" events for the Regula Orgy
# These are Guest themed events (for the female AI guests)
# They are used as filler for the Regula Orgy
### Events
## 1000 - 1999: Basic events
	# 1010: Relax, lose some stress
	# 1020: Gain some prestige
	# 1030: Gain some piety
	# 1040: Improve self
## 2000 - 2999: With Other Guest Events
	# 2010: Enjoy time with another female guest
	# 2020: Work on improving self with another guest
	# 2030: Become friends with another guest
	# 2040: Become lovers with another guest
	# 2050: Have a fight with another guest
## 3000 - 3999: Magister events (Should trigger events for the Magister)
	# 3010: Become charmed by spiral art
##################################################
##################################################
# 1000 - 1999: Basic events
# By Ban10
##################################################

# 1010: Relax, lose some stress
regula_orgy_guest.1010 = {
	type = activity_event
	title = regula_orgy_guest.1010.t
	desc = regula_orgy_guest.1010.desc
	theme = regula_orgy_theme

	trigger = {
		is_ai = yes

		OR = {
			stress_level >= 1
			stress >= 20
		}
	}

	immediate = {
		stress_impact = {
			base = medium_stress_loss
		}
	}

	option = {
		name = regula_guest_orgy.default
	}
}

# 1020: Gain some prestige
regula_orgy_guest.1020 = {
	type = activity_event
	title = regula_orgy_guest.1020.t
	desc = regula_orgy_guest.1020.desc
	theme = regula_orgy_theme

	trigger = {
		is_ai = yes
	}

	immediate = {
		add_prestige = minor_prestige_gain
	}

	option = {
		name = regula_guest_orgy.default
	}
}

# 1030: Gain some piety
regula_orgy_guest.1030 = {
	type = activity_event
	title = regula_orgy_guest.1030.t
	desc = regula_orgy_guest.1030.desc
	theme = regula_orgy_theme

	trigger = {
		is_ai = yes
	}

	immediate = {
		add_piety = minor_piety_gain
	}

	option = {
		name = regula_guest_orgy.default
	}
}

# 1040: Improve self
regula_orgy_guest.1040 = {
	type = activity_event
	title = regula_orgy_guest.1040.t
	desc = regula_orgy_guest.1040.desc
	theme = regula_orgy_theme

	trigger = {
		is_ai = yes
	}

	immediate = {
		random_list = {
			1 = {
				add_diplomacy_skill = 1
			}
			1 = {
				add_martial_skill = 1
			}
			1 = {
				add_stewardship_skill = 1
			}
			1 = {
				add_intrigue_skill = 1
			}
			1 = {
				add_learning_skill = 1
			}
		}
	}

	option = {
		name = regula_guest_orgy.default
	}
}

##################################################
# 2000 - 2999: With Other Guest Events
# By Ban10
##################################################
# 2010: Enjoy time with another female guest
regula_orgy_guest.2010 = {
	type = activity_event
	title = regula_orgy_guest.2010.t
	desc = regula_orgy_guest.2010.desc
	theme = regula_orgy_theme

	trigger = {
		is_ai = yes

		scope:activity = {
			any_attending_character = {
				is_female = yes
			}
		}
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					is_female = yes
					NOT = { this = root }
				}
				save_scope_as = other_guest
			}
		}

		scope:other_guest = {
			add_opinion = {
				target = root
				modifier = friendliness_opinion
				opinion = 10
			}
		}

		add_opinion = {
			target = scope:other_guest
			modifier = friendliness_opinion
			opinion = 10
		}
	}

	option = {
		name = regula_guest_orgy.default
	}
}

# 2020: Work on improving self with another guest
regula_orgy_guest.2020 = {
	type = activity_event
	title = regula_orgy_guest.2020.t
	desc = regula_orgy_guest.2020.desc
	theme = regula_orgy_theme

	trigger = {
		is_ai = yes

		scope:activity = {
			any_attending_character = {
				is_female = yes
				OR = {
					AND = {
						diplomacy > root.diplomacy
						root.diplomacy <= 10
					}
					AND = {
						martial > root.martial
						root.martial <= 10
					}
					AND = {
						stewardship > root.stewardship
						root.stewardship <= 10
					}
					AND = {
						intrigue > root.intrigue
						root.intrigue <= 10
					}
					AND = {
						learning > root.learning
						root.learning <= 10
					}
				}
			}
		}
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					is_female = yes
					OR = {
						AND = {
							diplomacy > root.diplomacy
							root.diplomacy <= 10
						}
						AND = {
							martial > root.martial
							root.martial <= 10
						}
						AND = {
							stewardship > root.stewardship
							root.stewardship <= 10
						}
						AND = {
							intrigue > root.intrigue
							root.intrigue <= 10
						}
						AND = {
							learning > root.learning
							root.learning <= 10
						}
					}
					NOT = { this = root }
				}
				save_scope_as = teacher
			}
		}

		random_list = {
			1 = {
				trigger = {
					scope:teacher.diplomacy > root.diplomacy
				}
				add_diplomacy_skill = 2
			}
			1 = {
				trigger = {
					scope:teacher.martial > root.martial
				}
				add_martial_skill = 2
			}
			1 = {
				trigger = {
					scope:teacher.stewardship > root.stewardship
				}
				add_stewardship_skill = 2
			}
			1 = {
				trigger = {
					scope:teacher.intrigue > root.intrigue
				}
				add_intrigue_skill = 2
			}
			1 = {
				trigger = {
					scope:teacher.learning > root.learning
				}
				add_learning_skill = 2
			}
		}

		add_opinion = {
			target = scope:teacher
			modifier = respect_opinion
			opinion = 10
		}
	}

	option = {
		name = regula_guest_orgy.default
	}
}

# 2030: Become friends with another guest
regula_orgy_guest.2030 = {
	type = activity_event
	title = regula_orgy_guest.2030.t
	desc = regula_orgy_guest.2030.desc
	theme = regula_orgy_theme

	trigger = {
		is_ai = yes

		scope:activity = {
			any_attending_character = {
				is_female = yes
				opinion = {
					target = root
					value >= 50
				}
				NOT = {
					has_relation_friend = root
					has_relation_best_friend = root
					this = root
				}
			}
		}
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					is_female = yes
					opinion = {
						target = root
						value >= 50
					}
					NOT = {
						has_relation_friend = root
						has_relation_best_friend = root
						this = root
					}
				}
				save_scope_as = friend
			}
		}

		scope:friend = {
			set_relation_friend = root
		}
	}

	option = {
		name = regula_guest_orgy.default
	}
}

# 2040: Become lovers with another guest
regula_orgy_guest.2040 = {
	type = activity_event
	title = regula_orgy_guest.2040.t
	desc = regula_orgy_guest.2040.desc
	theme = regula_orgy_theme

	trigger = {
		is_ai = yes
		OR = {
			has_sexuality = bisexual
			has_sexuality = homosexual
		}

		scope:activity = {
			any_attending_character = {
				is_female = yes
				opinion = {
					target = root
					value >= 50
				}
				OR = {
					has_sexuality = bisexual
					has_sexuality = homosexual
				}
				NOT = { has_relation_lover = root }
				NOT = { this = root }
			}
		}
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					is_female = yes
					opinion = {
						target = root
						value >= 50
					}
					OR = {
						has_sexuality = bisexual
						has_sexuality = homosexual
					}
					NOT = { has_relation_lover = root }
					NOT = { this = root }
				}
				save_scope_as = lover
			}
		}

		scope:lover = {
			set_relation_lover = root
		}
	}

	option = {
		name = regula_guest_orgy.default
	}
}

# 2050: Have a fight with another guest
regula_orgy_guest.2050 = {
	type = activity_event
	title = regula_orgy_guest.2050.t
	desc = regula_orgy_guest.2050.desc
	theme = regula_orgy_theme

	trigger = {
		is_physically_able_ai_adult = yes
		NOT = { has_trait = wounded }

		OR = { # Likely to start fights
			has_trait = vengeful
			has_trait = wrathful
			has_trait = arrogant
			has_trait = callous
			has_trait = sadistic
			has_trait = drunkard
		}

		scope:activity = {
			any_attending_character = {
				is_female = yes
				opinion = {
					target = root
					value >= -50
				}
			}
		}
	}

	immediate = {
		scope:activity = {
			random_attending_character = {
				limit = {
					is_female = yes
					opinion = {
						target = root
						value >= -50
					}
					NOT = { this = root }
				}
				weight = {
					base = 1
					modifier = {
						add = ai_vengefulness
					}
					modifier = {
						factor = 2
						trait_compatibility = {
							target = root
							value <= low_negative_trait_compatibility
						}
					}
					modifier = {
						factor = 10
						trait_compatibility = {
							target = root
							value <= medium_negative_trait_compatibility
						}
					}
				}
				save_scope_as = enemy
			}
		}

		scope:enemy = {
			duel = {
				skill = prowess
				target = root
				50 = {
					compare_modifier = {
						 value = scope:duel_value
						 multiplier = 3.5
						 min = -49
					}
					root = {
						increase_wounds_no_death_effect = { REASON = duel }
					}
				}
				50 = {
					compare_modifier = {
						value = scope:duel_value
						multiplier = -3.5
						min = -49
					}
					increase_wounds_no_death_effect = { REASON = duel }
				}
			}
		}
	}

	option = {
		name = regula_guest_orgy.default
	}
}

##################################################
# 3000 - 3999: Magister events (Should trigger events for the Magister)
# By Ban10
##################################################