namespace = sacredscrotum

######################################
# Finding a suitably blessed ballsack
######################################

character_event = {
	
	title = EVT.sacredscrotum.001
	id = sacredscrotum.001
	desc = EVTDESC.sacredscrotum.001
	picture = GFX_evt_beheading
	
	only_playable = yes
	prisoner = no
	ai = no
	only_men = yes
	
	trigger = {
		NOT = { has_global_flag = got_the_gonads }
		NOT = { religion_group = muslim }
		ROOT = {
			spouse = {
				lover = {
					is_priest = yes
					is_female = no
					is_liege_or_above = ROOT
				}
			}
		}
		OR = {
			intrigue = 10
			job_spymaster = { intrigue = 10 }
			AND = {
				ROOT = { 
					spouse = { intrigue < 5 }
				}
				ROOT = {
					spouse = {
						lover = { intrigue < 5 }
					}
				}
			}
		}
	}
	
	mean_time_to_happen = {
		days = 15
	}
	
	immediate = {
		ROOT = {
			spouse = {
				save_event_target_as = naughty_wife
			}
		}
		ROOT = {
			spouse = {
				lover = {
					save_event_target_as = naughty_priest
				}
			}
		}	
	}
		
	option = { #ignore the scandal
		name = EVTOPTA.sacredscrotum.001
		custom_tooltip = { text = EVTTOOLTIPA.sacredscrotum.001 }
	}
	option = { #humiliate everyone
		name = EVTOPTB.sacredscrotum.001
		opinion = {
			modifier = opinion_cheater
			who = event_target:naughty_wife
			months = 12
		}
		opinion = {
			modifier = opinion_rival
			who = event_target:naughty_priest
			years = 10
		}
		event_target:naughty_wife = {
			opinion = {
				modifier = opinion_shocked
				who = ROOT
				months = 12
			}
		}
		event_target:naughty_priest = {
			opinion = {
				modifier = opinion_rival
				who = ROOT
				years = 10
			}
		}
	}
	option = { #snatch the sack
		name = EVTOPTC.sacredscrotum.001
		trigger = {
			OR = {
				trait = amateurish_plotter
				trait = flamboyant_schemer
				trait = intricate_webweaver
				trait = elusive_shadow
				trait = lunatic
				trait = impaler
				trait = schemer
				trait = cruel
				trait = wroth
			}
		}
		tooltip_info_custom = EVTOPCTOOLTIPC.sacredscrotum.001
		character_event = { id = sacredscrotum.002 }
	}	
}

###############################
# Obtaining the sacred scrotum
###############################

character_event = {
	title = EVT.sacredscrotum.002
	id = sacredscrotum.002
	desc = EVTDESC.sacredscrotum.002
	picture = GFX_evt_courtiers_looking_scandalized
	
	is_triggered_only = yes
	
	immediate = {
		set_global_flag = got_the_gonads
	}
	
	option = {
		name = EVTOPTA.sacredscrotum.002
		add_artifact = sacred_scrotum
		event_target:naughty_priest = {
			add_trait = victim_surgery
			opinion = {
				modifier = opinion_evil_tyrant
				who = ROOT
			}
		}
		
	}
}
#########################################
# Using the theologically-enhanced testes
#########################################

character_event = {
	title = EVT.sacredscrotum.003
	id = sacredscrotum.003
	desc = EVTDESC.sacredscrotum.003
	picture = GFX_evt_character_reading_library

	only_playable = yes
	prisoner = no
	ai = no
	has_global_flag = got_the_gonads
	
	trigger = {
		ROOT = { has_artifact = sacred_scrotum }
		any_courtier = { trait = eunuch }
		any_realm_character = { learning = 20 }
	}
	
	immediate = {
		any_courtier = {
			if = {
				limit = { trait = eunuch }
				save_event_target_as = former_eunuch
			}
		}
	}
	
	mean_time_to_happen = {
		months = 3
	}

	option = { #don't think about it too much
		name = EVTOPTA.sacredscrotum.003
		custom_tooltip = { text = EVTTOOLTIPA.sacredscrotum.003}
	}

	option = { #it is not wise to play god
		name = EVTOPTB.sacrescrotum.003
		trigger = {
			OR = {
				trait = zealous
				trait = theologian
				trait = detached_priest
				trait = martial_cleric
				trait = scholarly_theologian
				trait = mastermind_theologian
			}	
		}
		piety = 30
	}

	option = { #we will return to this man what god has taken away
		name = EVTOPTC.sacredscrotum.003
		custom_tooltip = { text = EVTTOOLTIPC.sacredscrotum.003}
		narrative_event = { id = sacredscrotum.004 }
	}
}

narrative_event = { #the testes find a forever-home
	title = EVT.sacredscrotum.004
	id = sacredscrotum.004
	desc = EVTDESC.sacredscrotum.004
	picture = GFX_evt_roman_empire_restored
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA.sacredscrotum.004
		destroy_artifact = sacred_scrotum
		opinion = {
			modifier = opinion_friend
			who = event_target:former_eunuch
			years = 30
		}
		event_target:former_eunuch = {
			remove_trait = eunuch
			opinion = {
				modifier = opinion_friend
				who = ROOT
				years = 30
			}
		}
	}	
}