namespace = mistress_task

mistress_task.100 = { # Tale by the fire
	type = character_event
	title = mistress_task.100.t
	desc = mistress_task.100.desc
	theme = friendly
	override_background = { reference = bedchamber }
	left_portrait = {
		character = root
		animation = admiration
	}
	right_portrait = {
		character = scope:mistress
		animation = page_flipping
	}

	# Slight buff compared to the mistress event by letting it occur more frequently
	cooldown = { years = 3 }

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 1
			}
		}
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 2
			}
		}
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 3
			}
		}
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 4
			}
		}
	}

	trigger = {
		any_court_position_holder = {
			type = mistress_court_position
			NOT = {
				has_trait = blind
			}
		}
	}

	immediate = {
		random_court_position_holder = {
			type = mistress_court_position
			save_scope_as = mistress
		}

		if = {
			limit = {
				any_character_artifact = {
					artifact_slot_type = book
				}
			}
			random_character_artifact = {
				limit = {
					artifact_slot_type = book
				}
				save_scope_as = my_book
			}
		}

		set_random_entertainment_text_effect = yes
	}

	# Read existing book
	option = {
		name = mistress_task.100.c
		flavor = mistress_task.100.c_flavor

		trigger = {
			exists = scope:my_book
		}

		add_character_modifier = {
			modifier = reinvigorating_reading_modifier
			years = 3
		}

		stress_impact = {
			base = minor_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}

	# Enjoy the moment
	option = {
		name = mistress_task.100.a

		stress_impact = {
			base = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}

	# Boom boom time
	option = {
		name = mistress_task.100.b

		trigger = {
			is_eunuch_trigger = no
			scope:mistress = { is_eunuch_trigger = no }
			NOR = {
				has_trait = celibate
				scope:mistress = { has_trait = celibate }
			}
		}

		stress_impact = {
			base = minor_stress_impact_loss
			lustful = medium_stress_impact_loss
		}

		had_sex_with_effect = {
			CHARACTER = scope:mistress
			PREGNANCY_CHANCE = pregnancy_chance
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = chaste
				}
			}
		}
	}
}

mistress_task.200 = { # A Stroll Through the Gardens
	type = character_event
	title = mistress_task.200.t
	desc = mistress_task.200.desc
	theme = friendly
	override_background = { reference = garden }
	left_portrait = {
		character = root
		animation = love
	}
	right_portrait = {
		character = scope:mistress
		animation = love
	}

	cooldown = { years = 5 }

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 1
			}
		}
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 2
			}
		}
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 3
			}
		}
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 4
			}
		}
	}

	trigger = {
	}

	immediate = {
		random_court_position_holder = {
			type = mistress_court_position
			save_scope_as = mistress
		}
	}

	# Enjoy the walk
	option = {
		name = mistress_task.200.a

		stress_impact = {
			base = medium_stress_impact_loss
			just = minor_stress_impact_loss
			diligent = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}

	# Mediate the squabble
	option = {
		name = mistress_task.200.b

		trigger = {
			NOR = {
				has_trait = lazy
				has_trait = arbitrary
			}
		}

		stress_impact = {
			base = miniscule_stress_impact_gain
		}

		add_character_modifier = {
			modifier = garden_diplomat
			years = 5
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0.5
				OR = {
					has_trait = diligent
					has_trait = just
				}
			}
		}
	}
}

#Physician or herbalist or similar trait = Aromatherapy
mistress_task.300 = { # A plea-scent surprise
	type = character_event
	title = mistress_task.300.t
	desc = {
		desc = mistress_task.300.desc
	}
	theme = friendly
	override_background = { reference = bedchamber }
	left_portrait = {
		character = root
		animation = admiration
	}
	right_portrait = {
		character = scope:mistress
		animation = physician
	}

	cooldown = { years = 10 }

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 1
			}
		}
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 2
			}
		}
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 3
			}
		}
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 4
			}
		}
	}

	trigger = {
		any_court_position_holder = {
			type = mistress_court_position
			aptitude:mistress_court_position >= 2
			OR = {
				has_trait = lifestyle_mystic
				has_trait = lifestyle_gardener
				has_trait = lifestyle_herbalist
				has_trait = lifestyle_physician
				has_trait = scholar
				has_trait = witch
			}
		}
	}

	immediate = {
		random_court_position_holder = {
			type = mistress_court_position
			save_scope_as = mistress
		}
	}

	# Just enjoy it
	option = {
		name = mistress_task.300.a

		stress_impact = {
			base = major_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}

	# TODO: Another option where liege can freak out if they're craven or something else.
	# Can imprison your mistress if possible. But lazy to do this for now.
}

mistress_task.400 = { # Art session
	type = character_event
	title = mistress_task.400.t
	desc = mistress_task.400.desc
	theme = friendly
	override_background = { reference = garden }
	left_portrait = {
		character = root
		animation = interested
	}
	right_portrait = {
		character = scope:mistress
		animation = writing
	}

	cooldown = { years = 10 }

	weight_multiplier = {
		base = 1
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 1
			}
		}
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 2
			}
		}
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 3
			}
		}
		modifier = {
			add = 0.25
			any_court_position_holder = {
				type = mistress_court_position
				aptitude:mistress_court_position >= 4
			}
		}
	}

	trigger = {
		any_court_position_holder = {
			type = mistress_court_position
			NOT = {
				has_trait = blind
			}
		}
	}

	immediate = {
	}

	# Take it easy
	option = {
		name = mistress_task.400.a

		stress_impact = {
			base = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
		}
	}

	# Focus really really hard and produce an artifact!
	option = {
		name = mistress_task.400.b

		trigger = {
			NOT = {
				has_trait = lazy
			}
		}

		stress_impact = {
			base = medium_stress_impact_gain
		}

		hidden_effect_new_object = {
			generate_garden_sketch_effect = { OWNER = root }
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0.5
				OR = {
					has_trait = diligent
					has_trait = ambitious
				}
			}
		}
	}
}

# TODO: Event where they appear before you nekked

scripted_trigger valid_secret_holder = {
	is_available_ai_adult = yes
	NOT = {
		has_court_position = mistress_court_position
	}
	any_secret = {
		NOT = {
			is_known_by = root # Won't reveal a secret to you which you already know.
		}
	}
}

scripted_trigger generic_vassal = {
	is_available_ai_adult = yes
	is_married = yes
	primary_spouse = {
		is_ai = yes
	}
	NOT = {
		has_court_position = mistress_court_position
	}
}

# SOCIALISE OPTIONS

# Mistress improves your image - or damages it if low aptitude
# Mistress hosts a party! Prestiege goes up


mistress_task.1300 = { # Generic Stress Loss Feed Message
	type = character_event
	hidden = yes
	random_court_position_holder = {
		type = mistress_court_position
		save_scope_as = mistress
	}
	immediate = {
		send_interface_message = {
			type = event_stress_good
			title = mistress_task.1300.notification
			left_icon = scope:mistress
			add_stress = minor_stress_impact_loss
		}
	}
}
