###########################################
#                                         #
# M&M Hermetics Society Events            #
#                                         #
# ID MNM.1000-MNM.1999		              #
#                                         #
###########################################

#IDs:
#1000-1099 David
#1100-1199 Henrik
#1200-1399 Milla
#1400-1599 Mathilda
#1600-1799 Drikus
#1800-1899 Joel
#1900-1999 Emil


namespace = MNM

###JOINING###

#From on_character_ask_to_join_society
character_event = {
    id = MNM.100
	hide_window = yes
    is_triggered_only = yes
    trigger = {
    	FROM = { leader = { society_member_of = hermetics } }
    }
    immediate = {
    	if = { #Find a non-prisoner member
    		limit = { FROM = { leader = { prisoner = yes } } }
    		FROM = {
    			random_society_member = {
    				limit = { 
    					society_member_of = hermetics 
    					society_rank == 4
    					prisoner = no
    				}
    				character_event = { id = MNM.101 }
    				break = yes
    			}
    			random_society_member = {
    				limit = { 
    					society_member_of = hermetics 
    					society_rank == 3
    					prisoner = no
    				}
    				character_event = { id = MNM.101 }
    				break = yes
    			}
    			random_society_member = {
    				limit = { 
    					society_member_of = hermetics 
    					society_rank == 2
    					prisoner = no
    				}
    				character_event = { id = MNM.101 }
    				break = yes
    			}
    			random_society_member = {
    				limit = { 
    					society_member_of = hermetics 
    					society_rank == 1
    					prisoner = no
    				}
    				character_event = { id = MNM.101 }
    				break = yes
    			}
    		}
			#Everyone is somehow in prison so just use teh leader anyway
    	}
    	FROM = { leader = { character_event = { id = MNM.101 } } }
    }
}

#Ping event
character_event = {
    id = MNM.101
	hide_window = yes
    is_triggered_only = yes
    immediate = {
    	FROM = { letter_event = { id = MNM.102 } }
    }
}

#Welcome letter
letter_event = {
    id = MNM.102
    desc = EVTDESC_MNM_102 #Shamefully borrowing from the Pomandres
    border = GFX_event_letter_frame_religion

    is_triggered_only = yes
	
	immediate = { set_character_flag = society_join_block }

    option = {
        name = EVTOPTA_MNM_102

		join_society = hermetics
		
		clr_character_flag = society_join_block
    }
}

#MISSIONS

#Mission tombola
character_event = {
    id = MNM.1000
    hide_window = yes

    is_triggered_only = yes
    capable_only = yes
	is_in_society = yes

	trigger = {
		society_member_of = hermetics
		has_any_quest = no
		NOT = { has_character_modifier = quest_cooldown_timer }
		NOT = { is_inaccessible_trigger = yes }
		prisoner = no
		society = {
			any_society_member = {
				NOT = { character = ROOT }
				prisoner = no
				is_within_diplo_range = ROOT
				opinion = { who = ROOT value = 0 }
			}
		}
	}

    immediate = {
    	#Picks out mission giver
    	random_list = {
    		20 = { #International society member
    			society = {
    				random_society_member = {
    					limit = { 	
							NOT = { character = ROOT }
							prisoner = no
    						is_within_diplo_range = ROOT
							opinion = { who = ROOT value = 0 }
    					}
    					save_event_target_as = hermetic_collaborator
    				}
    			}
    		}
    		40 = { #Realm society member
    			trigger = {
    				society = {
    					any_society_member = {
    						NOT = { character = ROOT }
    						prisoner = no
    						is_within_diplo_range = ROOT
							opinion = { who = ROOT value = 0 }
							same_realm = ROOT
    					}
    				}
    			}
    			society = {
    				random_society_member = {
    					limit = { 	
    						NOT = { character = ROOT }
    						prisoner = no
    						is_within_diplo_range = ROOT
							opinion = { who = ROOT value = 0 }
							same_realm = ROOT
    					}
    					save_event_target_as = hermetic_collaborator
    				}
    			}
    		}
    		40 = { #Apprentice
    			trigger = {
    				any_courtier_or_vassal = { has_minor_title =  title_hermetics_apprentice prisoner = no }
					society_member_of = hermetics
    			}
    			random_courtier_or_vassal = {
    				limit = { has_minor_title =  title_hermetics_apprentice }
    				save_event_target_as = hermetic_collaborator
    			}
    		}
    	}


    	#Randomizes mission
    	random_list = {

    		20 = { #Find an apprentice
    			trigger = {
    				NOT = { any_courtier_or_vassal = { has_minor_title =  title_hermetics_apprentice } }
    				ai = no
    			}
    			event_target:hermetic_collaborator = { character_event = { id = MNM.1404 days = 7 random = 7 } }
    		}
			
			20 = { #Build a laboratory
				trigger = {
					NOT = { has_character_flag = building_laboratory }
					NOT = { has_character_flag = built_laboratory }
					OR = {
    					ai = no
    					society_rank == 4
    				}
    				is_landed = yes
				}
				event_target:hermetic_collaborator = { character_event = { id = MNM.1120 days = 7 random = 7 } }
			}
    		15 = { #Find a rare scroll/book/tablet
				trigger = {
					is_landed = yes
				}
    			event_target:hermetic_collaborator = { character_event = { id = MNM.1417 days = 7 random = 7 } }
    		}
			20 = { #Acquire/gather ingredients
				trigger = {
					is_landed = yes
					NOT = {
						any_artifact = {
							has_artifact_flag = ingredient
						}
					}
					event_target:hermetic_collaborator = { ai = yes }
				}
				event_target:hermetic_collaborator = { character_event = { id = MNM.1801 days = 7 random = 7 } }
			}
    		10 = { #Infiltrate lab
    			trigger = {
    				society = {
    					any_society_member = {
    						is_within_diplo_range = ROOT
    						NOR = { 
    							character = ROOT
    							character = event_target:hermetic_collaborator
    							reverse_opinion = { who = event_target:hermetic_collaborator value = 20 }
    							reverse_opinion = { who = ROOT value = 20 }
    							has_character_flag = infiltration_rival
    							has_character_flag = infiltration_mutual_dislike
    							has_character_flag = infiltration_rich
    						}
    					}
    				}
    			}
    			event_target:hermetic_collaborator = { character_event = { id = MNM.1430 days = 7 random = 7 } }
    		}
			10 = { #Observe stars
				event_target:hermetic_collaborator = { character_event = { id = MNM.1828 days = 7 random = 7 } } 
			}
			
			105 = { # AI bypasses missions at times
				modifier = {
					factor = 0
					ai = no
				}
				random_list = {
					70 = {
						modifier = {
							factor = 0.9
							society_influence >= 30
						}
						modifier = {
							factor = 0.9
							society_influence >= 40
						}
						modifier = {
							factor = 0.8
							society_influence >= 50
						}
						modifier = {
							factor = 0.7
							society_influence >= 70
						}
						modifier = {
							factor = 0.6
							society_influence >= 80
						}
						modifier = {
							factor = 0.5
							society_influence >= 90
						}
						add_mission_succeed_influence_effect = yes
					}
					30 = {
						add_mission_fail_influence_effect = yes
					}
				}
			}
			
			175 = {
				modifier = {
					factor = 0
					ai = no
				}
				#Do nothing for AI
			}
    	}
    }
}

#Mission: Building a Laboratory
#Flags:
#Temporary:
#building_laboratory (cleared at end)
#decided_on_glass (cleared at end)
#decided_on_crucibles (cleared at end)
#decided_on_tools (cleared at end)
#decided_on_books (cleared at end)
#Not Temporary:
#built_laboratory (not cleared -> set at end, marks this as done for this character)
#hidden_lab (not cleared -> to be used to weight stealing of secrets)
#very_hidden_lab (not cleared -> to be used to weight stealing of secrets)
character_event = {
	id = MNM.1100
	desc = EVTDESC_MNM_1100
	picture = GFX_evt_castle_construction
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_MNM_1100
		hidden_tooltip = {
			character_event = { id = MNM.1101 days = 7 }
			set_variable = { which = laboratory_level value = 1 }
		}
	}
	option = {
		name = EVTOPTB_MNM_1100
		clr_character_flag = building_laboratory
		wealth = 50
	}
}

#Where should the Laboratory be built?
character_event = { 
	id = MNM.1101
	desc = EVTDESC_MNM_1101
	picture = GFX_evt_castle_construction
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	trigger = {
		has_quest = quest_hermetics_build_laboratory
	}

	option = {
		name = EVTOPTA_MNM_1101 #In my Castle, hidden away
		custom_tooltip = {
			text = hidden_lab_tooltip
			set_character_flag = hidden_lab
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 2 }
			character_event = { id = MNM.1102 days = 30 }
		}
	}
	option = {
		name = EVTOPTB_MNM_1101 #In an accessible place
		custom_tooltip = {
			text = accessible_lab_tooltip
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 5 }
			character_event = { id = MNM.1102 days = 30 }
		}
	}
	option = {
		name = EVTOPTC_MNM_1101 #On an island or other very remote place
		trigger = {
			OR = {
				intrigue = 15
				trait = paranoid
			}
			capital_scope = { port = yes }
		}
		custom_tooltip = {
			text = very_hidden_lab_tooltip
			set_character_flag = very_hidden_lab
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 3 }
			character_event = { id = MNM.1102 days = 30 }
		}
	}
	option = {
		name = EVTOPTD_MNM_1101 #On an island or other very remote place
		trigger = {
			OR = {
				intrigue = 15
				trait = paranoid
			}
			capital_scope = {
				port = no
			}
		}
		custom_tooltip = {
			text = very_hidden_lab_tooltip
			set_character_flag = very_hidden_lab
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 3 }
			character_event = { id = MNM.1102 days = 30 }
		}
	}
}

#What kind of laboratory should we build?
character_event = { 
	id = MNM.1102
	desc = EVTDESC_MNM_1102
	picture = GFX_evt_weaponsmith
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_MNM_1102 #
		custom_tooltip = {
			text = cheap_laboratory_setup
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 1 }
			set_variable = { which = lab_ambition value = 1 }
			random_list = {
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_glass } }
					character_event = { id = MNM.1103 days = 60 }
				}
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_crucibles } }
					character_event = { id = MNM.1104 days = 60 }
				}
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_tools } }
					character_event = { id = MNM.1105 days = 60 }
				}
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_books } }
					character_event = { id = MNM.1106 days = 60 }
				}
			}
			random_list = { #Accidents
				25 = { } #Nothing Happens
				25 = { character_event = { id = MNM.1113 days = 30 } }
				25 = { character_event = { id = MNM.1114 days = 30 } }
				25 = { character_event = { id = MNM.1115 days = 30 } }
			}
		}
	}
	option = {
		name = EVTOPTB_MNM_1102 #
		wealth = -20
		custom_tooltip = {
			text = efficient_laboratory_setup
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 3 }
			set_variable = { which = lab_ambition value = 2 }
			random_list = {
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_glass } }
					character_event = { id = MNM.1103 days = 30 }
				}
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_crucibles } }
					character_event = { id = MNM.1104 days = 30 }
				}
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_tools } }
					character_event = { id = MNM.1105 days = 30 }
				}
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_books } }
					character_event = { id = MNM.1106 days = 30 }
				}
			}
			random_list = { #Accidents
				25 = { } #Nothing Happens
				25 = { character_event = { id = MNM.1113 days = 45 } }
				25 = { character_event = { id = MNM.1114 days = 45 } }
				25 = { character_event = { id = MNM.1115 days = 45 } }
			}
		}
	}
	option = {
		name = EVTOPTC_MNM_1102 #State of the Art.
		trigger = {
			OR = {
				learning = 15
				AND = { #Both master and apprentice have acceptable learning
					learning = 12
					any_courtier_or_vassal = {
						has_minor_title = title_hermetics_apprentice
						learning = 12
					}
				}
			}
		}
		wealth = -35
		custom_tooltip = {
			text = large_laboratory_setup
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 5 }
			set_variable = { which = lab_ambition value = 3 }
			random_list = {
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_glass } }
					character_event = { id = MNM.1103 days = 30 }
				}
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_crucibles } }
					character_event = { id = MNM.1104 days = 30 }
				}
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_tools } }
					character_event = { id = MNM.1105 days = 30 }
				}
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_books } }
					character_event = { id = MNM.1106 days = 30 }
				}
			}
			random_list = { #Accidents
				25 = { } #Nothing Happens
				25 = { character_event = { id = MNM.1113 days = 45 } }
				25 = { character_event = { id = MNM.1114 days = 45 } }
				25 = { character_event = { id = MNM.1115 days = 45 } }
			}
		}
	}
	option = {
		name = EVTOPTD_MNM_1102 #Experimental setup
		trigger = {
			OR = {
				learning = 25
				AND = { #Both have good learning
					learning = 15
					any_courtier_or_vassal = {
						has_minor_title = title_hermetics_apprentice
						learning = 15
					}
				}
			}
		}
		wealth = -50
		custom_tooltip = {
			text = extravagant_laboratory_setup
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 8 }
			set_variable = { which = lab_ambition value = 4 }
			random_list = {
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_glass } }
					character_event = { id = MNM.1103 days = 30 }
				}
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_crucibles } }
					character_event = { id = MNM.1104 days = 30 }
				}
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_tools } }
					character_event = { id = MNM.1105 days = 30 }
				}
				25 = {
					trigger = { NOT = { has_character_flag = decided_on_books } }
					character_event = { id = MNM.1106 days = 30 }
				}
			}
			random_list = { #Accidents
				25 = { } #Nothing Happens
				25 = { character_event = { id = MNM.1113 days = 45 } }
				25 = { character_event = { id = MNM.1114 days = 45 } }
				25 = { character_event = { id = MNM.1115 days = 45 } }
			}
		}
	}
}

#What kind of equipment do we need?
#Variant 1 - Flasks, Alembics, test tubes, etc
character_event = { 
	id = MNM.1103
	desc = EVTDESC_MNM_1103
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			set_character_flag = decided_on_glass
		}
	}
	
	option = {
		name = EVTOPTA_MNM_1103 #
		custom_tooltip = {
			text = non_fancy_laboratory_glass_tooltip
		}
		hidden_effect = {
			change_variable = {
				which = laboratory_level value = 1
			}
			change_variable = { which = lab_ambition value = -1 }
			if = {
				limit = {
					check_variable = {
						which = lab_ambition
						value = 1
					}
				}
				random_list = {
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_glass } }
						character_event = { id = MNM.1103 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_crucibles } }
						character_event = { id = MNM.1104 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_tools } }
						character_event = { id = MNM.1105 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_books } }
						character_event = { id = MNM.1106 days = 30 }
					}
				}
			}
			if = {
				limit = {
					NOT = {
						check_variable = {
							which = lab_ambition
							value = 1
						}
					}
				}
				character_event = { id = MNM.1107 days = 60 }
			}
		}
	}
	option = {
		name = EVTOPTB_MNM_1103 #
		wealth = -20
		custom_tooltip = {
			text = fancy_laboratory_glass_tooltip
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 2 }
			change_variable = { which = lab_ambition value = -1 }
			if = {
				limit = {
					check_variable = {
						which = lab_ambition
						value = 1
					}
				}
				random_list = {
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_glass } }
						character_event = { id = MNM.1103 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_crucibles } }
						character_event = { id = MNM.1104 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_tools } }
						character_event = { id = MNM.1105 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_books } }
						character_event = { id = MNM.1106 days = 30 }
					}
				}
			}
			if = {
				limit = {
					NOT = {
						check_variable = {
							which = lab_ambition
							value = 1
						}
					}
				}
				character_event = { id = MNM.1107 days = 60 }
			}
		}
	}
}

#Variant 2 - Crucibles
character_event = {
	id = MNM.1104
	desc = EVTDESC_MNM_1104
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		hidden_effect = {
			set_character_flag = decided_on_crucibles
		}
	}

	option = {
		name = EVTOPTA_MNM_1104 #
		custom_tooltip = {
			text = non_fancy_laboratory_crucibles_tooltip
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 1 }
			change_variable = { which = lab_ambition value = -1 }
			if = {
				limit = {
					check_variable = {
						which = lab_ambition
						value = 1
					}
				}
				random_list = {
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_glass } }
						character_event = { id = MNM.1103 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_crucibles } }
						character_event = { id = MNM.1104 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_tools } }
						character_event = { id = MNM.1105 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_books } }
						character_event = { id = MNM.1106 days = 30 }
					}
				}
			}
			if = {
				limit = {
					NOT = {
						check_variable = {
							which = lab_ambition
							value = 1
						}
					}
				}
				character_event = { id = MNM.1107 days = 60 }
			}
		}
	}
	option = {
		name = EVTOPTB_MNM_1104 #
		wealth = -20
		custom_tooltip = {
			text = fancy_laboratory_crucibles_tooltip
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 2 }
			change_variable = { which = lab_ambition value = -1 }
			if = {
				limit = {
					check_variable = {
						which = lab_ambition
						value = 1
					}
				}
				random_list = {
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_glass } }
						character_event = { id = MNM.1103 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_crucibles } }
						character_event = { id = MNM.1104 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_tools } }
						character_event = { id = MNM.1105 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_books } }
						character_event = { id = MNM.1106 days = 30 }
					}
				}
			}
			if = {
				limit = {
					NOT = {
						check_variable = {
							which = lab_ambition
							value = 1
						}
					}
				}
				character_event = { id = MNM.1107 days = 60 }
			}
		}
	}
}

#Variant 3 - Iron Tools
character_event = { 
	id = MNM.1105
	desc = EVTDESC_MNM_1105
	picture = GFX_evt_weaponsmith
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		hidden_effect = {
			set_character_flag = decided_on_tools
		}
	}

	option = {
		name = EVTOPTA_MNM_1105 #
		custom_tooltip = {
			text = non_fancy_laboratory_tools_tooltip
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 1 }
			change_variable = { which = lab_ambition value = -1 }
			if = {
				limit = {
					check_variable = {
						which = lab_ambition
						value = 1
					}
				}
				random_list = {
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_glass } }
						character_event = { id = MNM.1103 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_crucibles } }
						character_event = { id = MNM.1104 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_tools } }
						character_event = { id = MNM.1105 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_books } }
						character_event = { id = MNM.1106 days = 30 }
					}
				}
			}
			if = {
				limit = {
					NOT = {
						check_variable = {
							which = lab_ambition
							value = 1
						}
					}
				}
				character_event = { id = MNM.1107 days = 60 }
			}
		}
	}
	option = {
		name = EVTOPTB_MNM_1105 #
		wealth = -20
		custom_tooltip = {
			text = fancy_laboratory_tools_tooltip
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 2 }
			change_variable = { which = lab_ambition value = -1 }
			if = {
				limit = {
					check_variable = {
						which = lab_ambition
						value = 1
					}
				}
				random_list = {
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_glass } }
						character_event = { id = MNM.1103 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_crucibles } }
						character_event = { id = MNM.1104 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_tools } }
						character_event = { id = MNM.1105 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_books } }
						character_event = { id = MNM.1106 days = 30 }
					}
				}
			}
			if = {
				limit = {
					NOT = {
						check_variable = {
							which = lab_ambition
							value = 1
						}
					}
				}
				character_event = { id = MNM.1107 days = 60 }
			}
		}
	}
}

#Variant 4 - Books
#Herbals, Lapidarii, etc
character_event = { 
	id = MNM.1106
	desc = EVTDESC_MNM_1106
	picture = GFX_evt_book_carolingian_script
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		hidden_effect = {
			set_character_flag = decided_on_books
		}
	}

	option = {
		name = EVTOPTA_MNM_1106 #
		custom_tooltip = {
			text = non_fancy_laboratory_books_tooltip
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 1 }
			change_variable = { which = lab_ambition value = -1 }
			if = {
				limit = {
					check_variable = {
						which = lab_ambition
						value = 1
					}
				}
				random_list = {
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_glass } }
						character_event = { id = MNM.1103 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_crucibles } }
						character_event = { id = MNM.1104 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_tools } }
						character_event = { id = MNM.1105 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_books } }
						character_event = { id = MNM.1106 days = 30 }
					}
				}
			}
			if = {
				limit = {
					NOT = {
						check_variable = {
							which = lab_ambition
							value = 1
						}
					}
				}
				character_event = { id = MNM.1107 days = 60 }
			}
		}
	}
	option = {
		name = EVTOPTB_MNM_1106 #
		wealth = -20
		custom_tooltip = {
			text = fancy_laboratory_books_tooltip
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = 2 }
			change_variable = { which = lab_ambition value = -1 }
			if = {
				limit = {
					check_variable = {
						which = lab_ambition
						value = 1
					}
				}
				random_list = {
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_glass } }
						character_event = { id = MNM.1103 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_crucibles } }
						character_event = { id = MNM.1104 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_tools } }
						character_event = { id = MNM.1105 days = 30 }
					}
					25 = {
						trigger = { NOT = { has_character_flag = decided_on_books } }
						character_event = { id = MNM.1106 days = 30 }
					}
				}
			}
			if = {
				limit = {
					NOT = {
						check_variable = {
							which = lab_ambition
							value = 1
						}
					}
				}
				character_event = { id = MNM.1107 days = 60 }
			}
		}
	}
}

#Work is done
character_event = {
	id = MNM.1107
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		hidden_effect = {
			set_character_flag = built_laboratory
			clr_character_flag = building_laboratory
			clr_character_flag = decided_on_glass
			clr_character_flag = decided_on_crucibles
			clr_character_flag = decided_on_tools
			clr_character_flag = decided_on_books
			if = {
				limit = {
					NOT = {
						check_variable = {
							which = laboratory_level
							value = 6
						}
					}
				}
				character_event = { id = MNM.1108 } # Cheap Laboratory
			}
			if = {
				limit = {
					check_variable = {
						which = laboratory_level
						value = 6
					}
					NOT = {
						check_variable = {
							which = laboratory_level
							value = 12
						}
					}
				}
				character_event = { id = MNM.1109 } # Normal Laboratory
			}
			if = {
				limit = {
					check_variable = {
						which = laboratory_level
						value = 12
					}
					NOT = {
						check_variable = {
							which = laboratory_level
							value = 18
						}
					}
				}
				character_event = { id = MNM.1110 } # Good Laboratory
			}
			if = {
				limit = {
					check_variable = {
						which = laboratory_level
						value = 18
					}
					NOT = {
						check_variable = {
							which = laboratory_level
							value = 23
						}
					}
				}
				narrative_event = { id = MNM.1111 } # Great Laboratory
			}
			if = {
				limit = {
					check_variable = {
						which = laboratory_level
						value = 23
					}
				}
				narrative_event = { id = MNM.1112 } # Best Laboratory
			}
		}
	}
}

#Finished Cheap Lab
character_event = {
	id = MNM.1108
	desc = EVTDESC_MNM_1108
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_MNM_1108 #
		add_character_modifier = {
			name = "cheap_laboratory"
			duration = -1
		}
		hidden_effect = {
			character_event = { id = MNM.1122 }
		}
	}
}

#Finished Normal Lab
character_event = {
	id = MNM.1109
	desc = EVTDESC_MNM_1109
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_MNM_1109 #
		economy_techpoints = 5
		add_character_modifier = {
			name = "normal_laboratory"
			duration = -1
		}
		hidden_effect = {
			character_event = { id = MNM.1122 }
		}
	}
}

#Finished Good Lab
character_event = {
	id = MNM.1110
	desc = EVTDESC_MNM_1110
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_MNM_1110 #
		economy_techpoints = 15
		add_character_modifier = {
			name = "good_laboratory"
			duration = -1
		}
		hidden_effect = {
			character_event = { id = MNM.1122 }
		}
	}
}

#Finished Great Lab
narrative_event = {
	id = MNM.1111
	title = EVTNAME_MNM_1111
	desc = EVTDESC_MNM_1111
	picture = GFX_evt_experiment
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_MNM_1111 #
		economy_techpoints = 30
		add_character_modifier = {
			name = "great_laboratory"
			duration = -1
		}
		hidden_effect = {
			character_event = { id = MNM.1122 }
		}
	}
}

#Finished Best Lab
narrative_event = {
	id = MNM.1112
	title = EVTNAME_MNM_1112
	desc = EVTDESC_MNM_1112
	picture = GFX_evt_experiment
	border = GFX_event_narrative_frame_religion
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_MNM_1112 #
		economy_techpoints = 50
		add_character_modifier = {
			name = "best_laboratory"
			duration = -1
		}
		hidden_effect = {
			character_event = { id = MNM.1122 }
		}
	}
}

#Laboratory Accidents

character_event = {
	id = MNM.1113
	desc = EVTDESC_MNM_1113
	picture = GFX_evt_burning_house_arabic
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		hidden_effect = {
			random_courtier = {
				save_event_target_as = sacrifice_for_science
			}
		}
	}

	option = {
		name = EVTOPTA_MNM_1113 #
		hidden_effect = {
			change_variable = { which = laboratory_level value = -2 }
		}
		if = {
			limit = { has_character_flag = hidden_lab } #Lab built in castle
			event_target:sacrifice_for_science = {
				add_maimed_trait_effect = yes
				if = {
					limit = {
						is_close_relative = ROOT
						NOT = { trait = cruel }
					}
					random_list = {
						80 = { }
						20 = { ROOT = { add_trait_depressed_effect = yes } }
					}
				}
			}
		}
	}
	option = {
		name = EVTOPTB_MNM_1113 #
		custom_tooltip = {
			text = efforts_to_improve_lab_security_tooltip
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = -1 }
		}
		wealth = -10
		if = {
			limit = { has_character_flag = hidden_lab } #Lab built in castle
			event_target:sacrifice_for_science = {
				add_maimed_trait_effect = yes
				if = {
					limit = {
						is_close_relative = ROOT
						NOT = { trait = cruel }
					}
					random_list = {
						80 = { }
						20 = { ROOT = { add_trait_depressed_effect = yes } }
					}
				}
			}
		}
	}

	after = {
		#destroy ingredients
		if = {
			limit = {
				any_artifact = {
		    		has_artifact_flag = ingredient
	    		}
			}
			destroy_random_ingredients_effect = yes
		}
	}
}

# Locals are gossiping 
character_event = {
	id = MNM.1114
	desc = EVTDESC_MNM_1114
	picture = GFX_evt_riots_byzantine
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_MNM_1114 #
		custom_tooltip = {
			text = accomodate_gossipers_tooltip
		}
		hidden_effect = {
			change_variable = { which = laboratory_level value = -2 }
		}
		
	}
	option = {
		name = EVTOPTB_MNM_1114 #
		prestige = -50
	}
}

#Rotting Ingredients
character_event = {
	id = MNM.1115
	desc = EVTDESC_MNM_1115
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_MNM_1115 #
		hidden_effect = {
			change_variable = { which = laboratory_level value = -1 }
		}
	}
	option = {
		name = EVTOPTB_MNM_1115 #
		wealth = -25
		hidden_effect = {
			change_variable = { which = laboratory_level value = 1 }
		}
	}

	after = {
		#destroy ingredients
		if = {
			limit = {
				OR = {
					has_a_herb_ingredient_trigger = yes
					has_an_animal_part_ingredient_trigger = yes
				}
			}
			custom_tooltip = {
				text = random_ingredients_are_destroyed_tt
				destroy_random_herb_or_animal_part_ingredients_effect = yes
			}
		}
	}
}

#Mission: Build a Laboratory
character_event = {
    id = MNM.1120
    hide_window = yes
    is_triggered_only = yes
    immediate = {
		FROM = {
			society_quest_event = { id = MNM.1121 days = 7 random = 7 }
		}
	}
}

#Letter from quest giver
society_quest_event = {
    id = MNM.1121

	desc = {
		text = EVTDESC_MNM_1121
		trigger = { 
			event_target:hermetic_collaborator = {
				NOT = { has_minor_title = title_hermetics_apprentice }
			}
		}
	}
	desc = {
		text = EVTDESC_MNM_1121_apprentice
		trigger = { 
			event_target:hermetic_collaborator = {
				has_minor_title = title_hermetics_apprentice
			}
		}
	}

    is_triggered_only = yes
   
    option = {
		name = ACCEPT
		ai_chance = { factor = 100 }
		set_quest = quest_hermetics_build_laboratory
	}

	option = {
		name = DECLINE
		ai_chance = { factor = 0 }
		custom_tooltip = { text = decline_quest_tooltip }
		add_character_modifier = {
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}
	}
}

#Quest Completed
character_event = {
    id = MNM.1122
    picture = GFX_evt_experiment
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes
	
	desc = {
		text = EVTDESC_MNM_1122_normal
		trigger = {
			FROM = {
				NOT = { has_character_modifier = good_laboratory }
				NOT = { has_character_modifier = great_laboratory }
				NOT = { has_character_modifier = best_laboratory }
			}
		}
	}
	
	desc = {
		text = EVTDESC_MNM_1122_rich
		trigger = {
			FROM = {
				OR = {
					has_character_modifier = good_laboratory
					has_character_modifier = great_laboratory
					has_character_modifier = best_laboratory
				}
			}
		}
	}

	trigger = { has_quest = quest_hermetics_build_laboratory }

    option = { 
        name = EVTOPTA_MNM_1122

        clr_quest = quest_hermetics_find_apprentice
		sound_effect = hermetic_society_perform_experiment_01

        if = {
        	limit = {
				FROM = {
					NOT = { has_character_modifier = good_laboratory }
					NOT = { has_character_modifier = great_laboratory }
					NOT = { has_character_modifier = best_laboratory }
				}
			}
 			add_society_currency_minor_effect = yes
        }
        if = {
        	limit = {
				FROM = {
					OR = {
						has_character_modifier = good_laboratory
						has_character_modifier = great_laboratory
					}
				}
			}
 			add_society_currency_medium_effect = yes
        }
		if = {
			limit = { FROM = { has_character_modifier = best_laboratory } }
			add_society_currency_major_effect = yes
		}
    }
}


#Mission: Find an apprentice
character_event = {
    id = MNM.1404
    hide_window = yes
    is_triggered_only = yes
    immediate = { FROM = { society_quest_event = { id = MNM.1405 days = 7 random = 7 } } }
}

society_quest_event = {
    id = MNM.1405
    desc = EVTDESC_MNM_1405

    is_triggered_only = yes
   
    option = {
		name = ACCEPT

		set_quest = quest_hermetics_find_apprentice

		hidden_effect = { character_event = { id = MNM.1406 days = 150 random = 50 } } 
	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = {
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

#Still no apprentice? Make one
character_event = {
    id = MNM.1406
    hide_window = yes
    is_triggered_only = yes
    trigger = { has_quest = quest_hermetics_find_apprentice }
    immediate = { 
    	random_list = {
    		50 = {
    			modifier = {
    				is_female = no
    				factor = 1.5
    			}
    			create_random_priest = {
    				random_traits = yes
    				dynasty = none
    				female = yes
    				age = 28
    			}
    			new_character = {
    				save_event_target_as = apprentice_candidate
    			}
    		}
    		50 = {
    			modifier = {
    				is_female = yes
    				factor = 1.5
    			}
    			create_random_priest = {
    				random_traits = yes
    				dynasty = none
    				female = no
    				age = 28
    			}
    			new_character = {
    				save_event_target_as = apprentice_candidate
    			}
    		}
    	}

    	event_target:apprentice_candidate = {
    		remove_trait = slow
    		remove_trait = imbecile
    		remove_trait = inbred
    		remove_trait = dull
    		remove_trait = zealous
    		remove_trait = cynical
    		remove_trait = genius
    		remove_trait = quick
    		remove_trait = shrewd
    		remove_trait = slothful

    		#Add great trait
    		random_list = {
    			10 = { add_trait = genius }
    			10 = { add_trait = quick }
    			10 = { add_trait = shrewd }
    			10 = { trigger = { NOT = { religion_group = muslim } } add_trait = scholar }
    			10 = { trigger = { religion_group = muslim } add_trait = faqih }
    			10 = { add_trait = mystic }
    			10 = { add_trait = gardener }
    			10 = { trigger = { has_dlc = Reapers} add_trait = physician }
    			40 = { } #Nothing
    		}

    		#Add good trait 
    		random_list = {
    			10 = { add_trait = erudite }
    			10 = { add_trait = diligent }
    			10 = { 
    				add_trait = patient 
    				remove_trait = wroth
    			}
    			10 = {
    				add_trait = chaste
    				remove_trait = lustful
    			}
    			30 = {
    				add_trait = ambitious
    				remove_trait = content
    			}
    		}

    		while = {
    			limit = { NOT = { learning = 10 } }
    			change_learning = 1
    		}

    		character_event = { id = MNM.1407 }
    	}
    }
}

character_event = {
    id = MNM.1407
    hide_window = yes
    is_triggered_only = yes
    immediate = { FROM = { character_event = { id = MNM.1408 } } }
}

#What about this servant?
character_event = {
    id = MNM.1408
    desc = EVTDESC_MNM_1408
    picture = GFX_evt_experiment
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

    immediate = {

    }

    option = { 
        name = EVTOPTA_MNM_1408

 		FROM = { give_minor_title = title_hermetics_apprentice }

 		clr_quest = quest_hermetics_find_apprentice
		sound_effect = hermetic_society_perform_experiment_01
 		add_society_currency_minor_effect = yes
    }

    option = {
        name = EVTOPTB_MNM_1408
        custom_tooltip = { text = EVTOPTB_MNM_1408_TT }
    }
}

#You completed the quest by assigning someone the title
character_event = {
    id = MNM.1409
    desc = EVTDESC_MNM_1409
    picture = GFX_evt_experiment
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

    option = { 
        name = EVTOPTA_MNM_1409

        clr_quest = quest_hermetics_find_apprentice
		sound_effect = hermetic_society_perform_experiment

        if = {
        	limit = { FROM = { NOT = { learning = 12 } } }
 			add_society_currency_minor_effect = yes
        }
        if = {
        	limit = { FROM = { learning = 12 } }
 			add_society_currency_medium_effect = yes
        }
    }
}


#Mission: Find rare scroll/tome/tablet
character_event = {
    id = MNM.1417
    hide_window = yes
    is_triggered_only = yes
	
	trigger = { 
		is_alive = yes 
		NOT = { is_dying = yes } 
	}
	
    immediate = { FROM = { character_event = { id = MNM.1418 } } }
}


society_quest_event = {
    id = MNM.1418
    desc = EVTDESC_MNM_1418

    is_triggered_only = yes
   
    option = {
		name = ACCEPT

		FROM = {
			set_quest_target = {
				id = quest_hermetics_find_text
				holder = ROOT
			}
		}

		hidden_effect = { FROM = { character_event = { id = MNM.1419 days = 5 } } }
	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = {
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

#Ping event
character_event = {
    id = MNM.1419		
    hide_window = yes
    is_triggered_only = yes
    immediate = { FROM = { letter_event = { id = MNM.1420 } } }
}		

#Where should we go looking?
letter_event = {
    id = MNM.1420
    border = GFX_event_letter_frame_religion

    is_triggered_only = yes

    trigger = { has_quest = quest_hermetics_find_text }

    desc = {
    	trigger = { 
    		OR = {
    			NOT = { FROM = { has_character_flag = alexandria } }
    			has_artifact = emerald_tablet
    		}
    	}
    	text = EVTDESC_MNM_1420_A
    }
    desc = {
    	trigger = { 
    		FROM = { has_character_flag = alexandria } 
    		NOT = { has_artifact = emerald_tablet }
    	}
    	text = EVTDESC_MNM_1420_B
    }

    immediate = {
    	set_character_flag = do_not_disturb 

    	FROM = { #Chance of having Alexandria as an option
    		random = {
	    		chance = 10
	    		modifier = {
	    			learning = 12
	    			factor = 1.2
	    		}
	    		modifier = {
	    			learning = 14
	    			factor = 1.2
	    		}
	    		modifier = {
	    			learning = 16
	    			factor = 1.2
	    		}
	    		modifier = {
	    			learning = 18
	    			factor = 1.2
	    		}
	    		modifier = {
	    			learning = 20
	    			factor = 1.2
	    		}
	    		set_character_flag = alexandria 
	    	}
    	}

    	#Locations
    	random_independent_ruler = {
    		limit = {
    			is_within_diplo_range = ROOT
    			NOT = { same_realm = ROOT }
    			any_realm_province = { is_capital = no }
    		}
    		random_realm_province = {
    			limit = { is_capital = no }
    			save_event_target_as = ruin_site
    			owner = { top_liege = { save_event_target_as = ruin_site_top_liege } }
    		}
    	}
    	if = {
    		limit = { ai = no }
	    	random_independent_ruler = {
	    		limit = { 
	    			is_within_diplo_range = ROOT
	    			NOT = { same_realm = ROOT }
	    			any_realm_title = {
	    				tier = DUKE
	    				OR = {
	    					title = d_alexandria
	    					title = d_damietta
	    					title = d_cairo
	    					title = d_kufra
	    					title = d_sinai
	    					region = world_middle_east_jerusalem
							region = world_europe_south_east
							region = world_asia_minor
	    				}
	    			}
	    		}
	    		random_realm_province = {
	    			save_event_target_as = ruin_site
	    			owner = { top_liege = { save_event_target_as = ruin_site_top_liege } }
	    		}
	    	}
    	}
    	random_realm_province = {
    		save_event_target_as = temple_site
    	}
    	random_realm_province = {
    		limit = {
    			any_province_holding = { holding_type = temple }
    			is_capital = no
    		}
    		save_event_target_as = temple_site
    	}
    }
    
    #Go to Alexandria!
    option = { 
    	trigger = { 
    		FROM = { has_character_flag = alexandria } 
    		NOT = { has_artifact = emerald_tablet }
    		OR = {
    			ai = no
    			scaled_wealth = 1 
    			wealth = 200
    		}
    	}
        name = EVTOPTA_MNM_1420
        custom_tooltip = { text = EVTOPTA_MNM_1420_TT }

        scaled_wealth = { value = -1 min = -200 }

        random_list = {
        	20 = {
        		modifier = { learning = 8 factor = 1.2 }
        		modifier = { learning = 11 factor = 1.2 }
        		modifier = { learning = 14 factor = 1.2 }
        		modifier = { learning = 17 factor = 1.2 }
        		modifier = { learning = 20 factor = 1.2 }
	    		modifier = { FROM = { learning = 8 } factor = 1.2 }
        		modifier = { FROM = { learning = 11 } factor = 1.2 }
        		modifier = { FROM = { learning = 14 } factor = 1.2 }
        		modifier = { FROM = { learning = 17 } factor = 1.2 }
        		modifier = { FROM = { learning = 20 } factor = 1.2 }
        		custom_tooltip = {
        			text = EVTOPTX_MNM_1420_SUCCESS
        			FROM = { 
        				set_character_flag = A_SUCCESS
        				character_event = { id = MNM.1421 days = 300 random = 150 }
        			}
        		}
        		tooltip = { add_society_currency_massive_effect = yes }
        	}
        	80 = {
        		tooltip = { clr_quest = { id = quest_hermetics_find_text failure = yes } }
        		hidden_effect = {
        			FROM = { 
        				set_character_flag = A_FAIL
        				character_event = { id = MNM.1421 days = 300 random = 150 }
        			}
        		}
        	}
        }
    }

    #Search foreign ruin
    option = {
    	trigger = {
    		OR = {
    			ai = no
    			scaled_wealth = 0.5 
    			wealth = 100
    		}
    	}
        name = EVTOPTB_MNM_1420
        custom_tooltip = { text = EVTOPTB_MNM_1420_TT }

        scaled_wealth = { value = -0.5 min = -100 }

        random_list = {
        	35 = {
        		modifier = { learning = 8 factor = 1.2 }
        		modifier = { learning = 11 factor = 1.2 }
        		modifier = { learning = 14 factor = 1.2 }
        		modifier = { learning = 17 factor = 1.2 }
        		modifier = { learning = 20 factor = 1.2 }
	    		modifier = { FROM = { learning = 8 } factor = 1.2 }
        		modifier = { FROM = { learning = 11 } factor = 1.2 }
        		modifier = { FROM = { learning = 14 } factor = 1.2 }
        		modifier = { FROM = { learning = 17 } factor = 1.2 }
        		modifier = { FROM = { learning = 20 } factor = 1.2 }
        		custom_tooltip = {
        			text = EVTOPTX_MNM_1420_SUCCESS
        			FROM = { 
        				set_character_flag = B_SUCCESS
        				character_event = { id = MNM.1421 days = 150 random = 75 }
        			}
        		}
        		tooltip = { add_society_currency_major_effect = yes }
        	}
        	65 = {
        		tooltip = { clr_quest = { id = quest_hermetics_find_text failure = yes } }
        		hidden_effect = {
        			FROM = { 
        				set_character_flag = B_FAIL
        				character_event = { id = MNM.1421 days = 150 random = 75 }
        			}
        		}
        	}
        }
    }
    
    #Search local ruin
    option = {
    	trigger = {
    		OR = {
    			ai = no
    			scaled_wealth = 0.2
    			wealth = 40
    		}
    	}
        name = EVTOPTC_MNM_1420
        custom_tooltip = { text = EVTOPTC_MNM_1420_TT }

        scaled_wealth = { value = -0.2 min = -40 }

        random_list = {
        	55 = {
        		modifier = { learning = 8 factor = 1.2 }
        		modifier = { learning = 11 factor = 1.2 }
        		modifier = { learning = 14 factor = 1.2 }
        		modifier = { learning = 17 factor = 1.2 }
        		modifier = { learning = 20 factor = 1.2 }
	    		modifier = { FROM = { learning = 8 } factor = 1.2 }
        		modifier = { FROM = { learning = 11 } factor = 1.2 }
        		modifier = { FROM = { learning = 14 } factor = 1.2 }
        		modifier = { FROM = { learning = 17 } factor = 1.2 }
        		modifier = { FROM = { learning = 20 } factor = 1.2 }
        		custom_tooltip = {
        			text = EVTOPTX_MNM_1420_SUCCESS
        			FROM = { 
        				set_character_flag = C_SUCCESS
        				character_event = { id = MNM.1421 days = 100 random = 50 }
        			}
        		}
        		tooltip = { add_society_currency_medium_effect = yes }
        	}
        	45 = {
        		tooltip = { clr_quest = { id = quest_hermetics_find_text failure = yes } }
        		hidden_effect = {
        			FROM = { 
        				set_character_flag = C_FAIL
        				character_event = { id = MNM.1421 days = 100 random = 50 }
        			}
        		}
        	}
        }
    }
    
    #Local antiquarian
    option = {
        name = EVTOPTD_MNM_1420
        custom_tooltip = { text = EVTOPTD_MNM_1420_TT }

        scaled_wealth = { value = -0.05 min = -10 }

        random_list = {
        	70 = {
        		modifier = { learning = 8 factor = 1.2 }
        		modifier = { learning = 11 factor = 1.2 }
        		modifier = { learning = 14 factor = 1.2 }
        		modifier = { learning = 17 factor = 1.2 }
        		modifier = { learning = 20 factor = 1.2 }
	    		modifier = { FROM = { learning = 8 } factor = 1.2 }
        		modifier = { FROM = { learning = 11 } factor = 1.2 }
        		modifier = { FROM = { learning = 14 } factor = 1.2 }
        		modifier = { FROM = { learning = 17 } factor = 1.2 }
        		modifier = { FROM = { learning = 20 } factor = 1.2 }
        		custom_tooltip = {
        			text = EVTOPTX_MNM_1420_SUCCESS
        			FROM = { 
        				set_character_flag = D_SUCCESS
        				character_event = { id = MNM.1421 days = 30 random = 10 }
        			}
        		}
        		tooltip = { add_society_currency_minor_effect = yes }
        	}
        	30 = {
        		tooltip = { clr_quest = { id = quest_hermetics_find_text failure = yes } }
        		hidden_effect = {
        			FROM = { 
        				set_character_flag = D_FAIL
        				character_event = { id = MNM.1421 days = 30 random = 10 }
        			}
        		}
        	}
        }
    }
    #after = { hidden_effect = { character_event = { id = MNM.1427 days = 450 } } }
}

#Ping event for outcome in book search
character_event = {
    id = MNM.1421
    hide_window = yes
    is_triggered_only = yes

    immediate = {
    	if = {
    		limit = { FROM = { has_quest = quest_hermetics_find_text } }
	    	trigger_switch = {
	    		on_trigger 	= has_character_flag 
	    		A_SUCCESS	= { FROM = { narrative_event = { id = MNM.1422 } } }
	    		B_SUCCESS	= { FROM = { character_event = { id = MNM.1423 } } }
	    		C_SUCCESS	= { FROM = { character_event = { id = MNM.1424 } } }
	    		D_SUCCESS	= { FROM = { character_event = { id = MNM.1425 } } }
	    		A_FAIL		= { FROM = { character_event = { id = MNM.1426 } } }
	    		B_FAIL		= { FROM = { character_event = { id = MNM.1426 } } }
	    		C_FAIL		= { FROM = { character_event = { id = MNM.1426 } } }
	    		D_FAIL		= { FROM = { character_event = { id = MNM.1426 } } }
	    	}
    	}
    	if = {
    		limit = { NOT = { FROM = { has_quest = quest_hermetics_find_text } } }
    		clr_character_flag = A_FAIL
	    	clr_character_flag = B_FAIL
	    	clr_character_flag = C_FAIL
	    	clr_character_flag = D_FAIL
    	}
    	clr_character_flag = A_SUCCESS
    	clr_character_flag = B_SUCCESS
    	clr_character_flag = C_SUCCESS
    	clr_character_flag = D_SUCCESS
    	clr_character_flag = alexandria

    	FROM = { remove_do_not_disturb_effect = yes }
    }
}

#Emerald tablet in library of Alexandria
narrative_event = {
    id = MNM.1422
    title = EVTTITLE_MNM_1422
    desc = EVTDESC_MNM_1422
    picture = GFX_evt_religious_exultation
    border = GFX_event_narrative_frame_religion

    is_triggered_only = yes

    option = { 
        name = EVTOPTA_MNM_1422

        add_artifact = emerald_tablet

        clr_quest = quest_hermetics_find_text
		sound_effect = hermetic_society_recover_scroll
        add_society_currency_massive_effect = yes

        hidden_effect = {
	        opinion = {
	        	who = FROM
	        	modifier = epic_adventure
	        	years = 30
	        }
	    }
        reverse_opinion = {
        	who = FROM
        	modifier = epic_adventure
        	years = 30
        }
    }
}

#You found tablet in old ruin
character_event = {
    id = MNM.1423
    desc = EVTDESC_MNM_1423
    picture = GFX_evt_pagan
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

    option = { 
        name = EVTOPTA_MNM_1423

     	clr_quest = quest_hermetics_find_text
		sound_effect = hermetic_society_recover_scroll
        add_society_currency_major_effect = yes

        hidden_effect = {
	        opinion = {
	        	who = FROM
	        	modifier = great_adventure
	        	years = 30
	        }
	    }
        reverse_opinion = {
        	who = FROM
        	modifier = great_adventure
        	years = 30
        }   
    }
}

#You found old scroll in temple
character_event = {
    id = MNM.1424
    desc = EVTDESC_MNM_1424
    picture = GFX_evt_bishop
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

    option = { 
        name = EVTOPTA_MNM_1424

     	clr_quest = quest_hermetics_find_text
		sound_effect = hermetic_society_recover_scroll
        add_society_currency_medium_effect = yes

        hidden_effect = {
	        opinion = {
	        	who = FROM
	        	modifier = nice_adventure
	        	years = 30
	        }
	    }
        reverse_opinion = {
        	who = FROM
        	modifier = nice_adventure
        	years = 30
        }   
    }
}

#You found tome in library
character_event = {
    id = MNM.1425
    desc = EVTDESC_MNM_1425
    picture = GFX_evt_library
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

    option = { 
        name = EVTOPTA_MNM_1425

     	clr_quest = quest_hermetics_find_text
		sound_effect = hermetic_society_recover_scroll
        add_society_currency_minor_effect = yes
    }
}

#Failure
character_event = {
    id = MNM.1426
    picture = GFX_evt_desert
    border = GFX_event_normal_frame_religion

    desc = {
    	trigger = { FROM = { has_character_flag = A_FAIL } }
    	text = EVTDESC_MNM_1426_A
    	picture = GFX_evt_desert
    }
    desc = {
    	trigger = { FROM = { has_character_flag = B_FAIL } }
    	text = EVTDESC_MNM_1426_B
    	picture = GFX_evt_pagan
    }
    desc = {
    	trigger = { FROM = { has_character_flag = C_FAIL } }
    	text = EVTDESC_MNM_1426_C
    	picture = GFX_evt_bishop
    }
    desc = {
    	trigger = { FROM = { has_character_flag = D_FAIL } }
    	text = EVTDESC_MNM_1426_D
    	picture = GFX_evt_market
    }

    is_triggered_only = yes

    option = { 
        name = CURSES

        clr_quest = { id = quest_hermetics_find_text failure = yes }

        if = {
        	limit = { FROM = { has_character_flag = A_FAIL } }
        	add_rival = FROM
        }

        FROM = {
        	clr_character_flag = A_FAIL
        	clr_character_flag = B_FAIL
        	clr_character_flag = C_FAIL
        	clr_character_flag = D_FAIL
        }
    }
}



##Clearing of flag
#character_event = {
#    id = MNM.1427
#    hide_window = yes
#    is_triggered_only = yes
#    immediate = { remove_do_not_disturb_effect = yes }
#}


#Mission: Infiltrate laboratory
character_event = {
    id = MNM.1430
    hide_window = yes
    is_triggered_only = yes
    immediate = { 
    	FROM = { society_quest_event = { id = MNM.1431 days = 7 random = 7 } } 
    }
}

society_quest_event = {
    id = MNM.1431

    desc = {
    	trigger = { event_target:infiltration_target = { has_character_flag = infiltration_rival } }
    	text = EVTDESC_MNM_1431_A
    }
    desc = {
    	trigger = { event_target:infiltration_target = { has_character_flag = infiltration_mutual_dislike } }
    	text = EVTDESC_MNM_1431_B
    }
    desc = {
    	trigger = { event_target:infiltration_target = { has_character_flag = infiltration_rich } }
    	text = EVTDESC_MNM_1431_C
    }

    is_triggered_only = yes

    quest_target = event_target:infiltration_target
    
    immediate = {
    	random_list = {
    		30 = { #Their nemesis
    			trigger = {
    				society = {
    					any_society_member = {
    						is_within_diplo_range = ROOT
    						NOR = {
    							has_character_flag = infiltration_rival
    							has_character_flag = infiltration_mutual_dislike
    							has_character_flag = infiltration_rich
    						}
    						is_rival = FROM
    						NOT = { reverse_opinion = { who = ROOT value = 20 } }
    					}
    				}
    			}
    			society = {
    				random_society_member = {
    					limit = {
    						is_within_diplo_range = ROOT
    						NOR = {
    							has_character_flag = infiltration_rival
    							has_character_flag = infiltration_mutual_dislike
    							has_character_flag = infiltration_rich
    						}
    						is_rival = FROM
    						NOT = { reverse_opinion = { who = ROOT value = 20 } }
    					}
    					save_event_target_as = infiltration_target
    					set_character_flag = infiltration_rival
    				}
    			}
    		}
    		10 = { #Shared dislike 
    			trigger = {
    				society = {
    					any_society_member = {
    						is_within_diplo_range = ROOT
    						NOR = {
    							has_character_flag = infiltration_rival
    							has_character_flag = infiltration_mutual_dislike
    							has_character_flag = infiltration_rich
    						}
    						NOT = { reverse_opinion = { who = ROOT value = 0 } }
    						NOT = { reverse_opinion = { who = FROM value = 0 } }
    					}
    				}
    			}
    			society = {
    				random_society_member = {
    					limit = {
    						is_within_diplo_range = ROOT
    						NOR = {
    							has_character_flag = infiltration_rival
    							has_character_flag = infiltration_mutual_dislike
    							has_character_flag = infiltration_rich
    						}
    						NOT = { reverse_opinion = { who = ROOT value = 0 } }
    						NOT = { reverse_opinion = { who = FROM value = 0 } }
    					}
    					save_event_target_as = infiltration_target
    					set_character_flag = infiltration_mutual_dislike
    				}
    			}
    		}
    		10 = { #Rich target
    			trigger = {
    				society = {
    					any_society_member = {
    						is_within_diplo_range = ROOT
    						NOR = {
    							has_character_flag = infiltration_rival
    							has_character_flag = infiltration_mutual_dislike
    							has_character_flag = infiltration_rich
    						}
    						NOT = { reverse_opinion = { who = ROOT value = 20 } }
    						NOT = { reverse_opinion = { who = FROM value = 20 } }
    						OR = {
    							any_artifact = { has_artifact_flag = hermetic }
    							wealth = 200
    							has_character_modifier = best_laboratory
    							has_character_modifier = great_laboratory
    						}
    					}
    				}
    			}
    			modifier = {
    				OR = {
    					trait = greedy
    					trait = ambitious
    				}
    				factor = 2
    			}
    			society = {
    				random_society_member = {
    					limit = {
    						is_within_diplo_range = ROOT
    						NOR = {
    							has_character_flag = infiltration_rival
    							has_character_flag = infiltration_mutual_dislike
    							has_character_flag = infiltration_rich
    						}
    						NOT = { reverse_opinion = { who = ROOT value = 20 } }
    						NOT = { reverse_opinion = { who = FROM value = 20 } }
    						OR = {
    							any_artifact = { 
    								has_artifact_flag = hermetic 
    								has_artifact_flag = text 
    							}
    							wealth = 200
    							has_character_modifier = best_laboratory
    							has_character_modifier = great_laboratory
    						}
    					}
    					save_event_target_as = infiltration_target
    					set_character_flag = infiltration_rich
    				}
    			}
    		}
    		1 = { #Fallback
    			society = {
    				random_society_member = {
    					limit = {
    						is_within_diplo_range = ROOT
    						NOR = {
    							reverse_opinion = { who = FROM value = 20 }
    							reverse_opinion = { who = ROOT value = 20 }
    							has_character_flag = infiltration_rival
    							has_character_flag = infiltration_mutual_dislike
    							has_character_flag = infiltration_rich
    						}
    					}
    					save_event_target_as = infiltration_target
    					set_character_flag = infiltration_rich
    				}
    			}
    		}
    	}
    }

    option = {
		name = ACCEPT
		ai_chance = { factor = 100 }
		
		event_target:infiltration_target = {
			set_quest_target = {
				id = quest_hermetics_infiltrate_laboratory
				holder = ROOT
			}
		}

		hidden_effect = {
			FROM = { 
				save_event_target_as = infiltration_companion
				opinion = { who = ROOT modifier = opinion_infiltration_companion months = 100 }
				character_event = { id = MNM.1432 days = 14 }
			}
			event_target:infiltration_target = { character_event = { id = MNM.1456 days = 150 } }
		}
	}

	option = {
		name = DECLINE
		ai_chance = { factor = 0 }
		custom_tooltip = { text = decline_quest_tooltip }
		add_character_modifier = {
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}
		hidden_effect = { event_target:infiltration_target = { character_event = { id = MNM.1456 } } }
	}
}

#Search for lab or skip to security, done by collaborator
character_event = {
    id = MNM.1432
    hide_window = yes
    is_triggered_only = yes
    immediate = {

    	if = {
    		limit = { 
    			event_target:infiltration_target = {
    				OR = {
    					has_character_flag = hidden_lab
    					has_character_flag = very_hidden_lab
    				}
    			}
    		}
    		FROM = { letter_event = { id = MNM.1433 } } 
    	}
    	if = {
    		limit = { 
    			event_target:infiltration_target = {
    				NOR = {
    					has_character_flag = hidden_lab
    					has_character_flag = very_hidden_lab
    				}
    			}
    		}
    		FROM = { character_event = { id = MNM.1435 } } 
    	}
    }	
}

#Find out where the laboratory is hid
letter_event = {
    id = MNM.1433
    desc = EVTDESC_MNM_1433
    border = GFX_event_letter_frame_intrigue

    is_triggered_only = yes
    

    option = { 
        name = EVTOPTA_MNM_1433
        custom_tooltip = { text = EVTOPTA_MNM_1433_TT }

        hidden_effect = {
        	random_list = {
        		33 = { #It goes fast
        			modifier = { FROM = { intrigue = 12 } factor = 1.2 }
        			modifier = { FROM = { intrigue = 14 } factor = 1.2 }
        			modifier = { FROM = { intrigue = 16 } factor = 1.2 }
        			modifier = { FROM = { intrigue = 18 } factor = 1.2 }
        			FROM = { character_event = { id = MNM.1434 days = 15 random = 10 } }

        		}
        		33 = { #It goes slowly
					modifier = { event_target:infiltration_target = { has_character_flag = hidden_lab } factor = 1.5 }
					modifier = { FROM = { intrigue = 12 } factor = 1.1 }
        			modifier = { FROM = { intrigue = 14 } factor = 1.1 }
        			modifier = { FROM = { intrigue = 16 } factor = 1.1 }
        			modifier = { FROM = { intrigue = 18 } factor = 1.1 }
        			FROM = { character_event = { id = MNM.1434 days = 45 random = 30 } }
        		}
        		33 = { #It goes super slow
        			modifier = { event_target:infiltration_target = { has_character_flag = very_hidden_lab } factor = 2 }
        			FROM = { character_event = { id = MNM.1434 days = 90 random = 45 } }
        		}
        	}
        }
    }
}


character_event = {
    id = MNM.1434
    hide_window = yes
    is_triggered_only = yes

    trigger = { FROM = { has_quest = quest_hermetics_infiltrate_laboratory } }

    immediate = { FROM = { character_event = { id = MNM.1435 } } }
}


#Get past the guards
character_event = {
    id = MNM.1435
    picture = GFX_evt_eavesdropping 
    border = GFX_event_normal_frame_intrigue

	trigger = { has_quest = quest_hermetics_infiltrate_laboratory }
    
	immediate = {
		# Will select two ingredients, by prioritizing from the top, until it hits two available ones...
		select_random_hermetic_ingredient_herb_effect = yes
		select_random_hermetic_ingredient_animal_part_effect = yes
		select_random_hermetic_ingredient_powder_effect = yes
		select_random_hermetic_ingredient_liquid_effect = yes
		select_random_hermetic_ingredient_herb_effect = yes
		select_random_hermetic_ingredient_powder_effect = yes
		select_random_hermetic_ingredient_animal_part_effect = yes
		select_random_hermetic_ingredient_liquid_effect = yes
	}

    desc = {
    	trigger = { event_target:infiltration_target = { has_character_flag = very_hidden_lab } }
    	text = EVTDESC_MNM_1435_A
    }
    desc = {
    	trigger = { event_target:infiltration_target = { has_character_flag = hidden_lab } }
    	text = EVTDESC_MNM_1435_B
    }
    desc = {
    	trigger = { 
    		event_target:infiltration_target = { 
    			NOR = {
    				has_character_flag = very_hidden_lab
    				has_character_flag = hidden_lab
    			}
    		}
    	}	
    	text = EVTDESC_MNM_1435_C
    }

    is_triggered_only = yes
    
    #Bribe
    option = { 
    	trigger = {
    		OR = {
    			ai = no
    			scaled_wealth = 0.5
    		}
    		diplomacy = 12
    	}
        name = EVTOPTA_MNM_1435
        custom_tooltip = { text = EVTOPTA_MNM_1435_TT }
        tooltip_info = diplomacy

        if = {
        	limit = { event_target:infiltration_target = { has_character_flag = very_hidden_lab } }
        	scaled_wealth = { value = -0.75 min = -75 }
        }
        if = {
        	limit = { event_target:infiltration_target = { has_character_flag = hidden_lab } }
        	scaled_wealth = { value = -0.5 min = -50 }
        }
        if = {
        	limit = { 
        		NOR = {
        			event_target:infiltration_target = { has_character_flag = very_hidden_lab }
        			event_target:infiltration_target = { has_character_flag = hidden_lab } 
        		}
        	}
        	scaled_wealth = { value = -0.3 min = -30 }
        }

        set_character_flag = bribed_guards
        character_event = { id = MNM.1436 days = 7 }
    }

    #Make a sleeping potion (potentially great effect)
    option = {
    	tooltip_info = yes
        name = EVTOPTB_MNM_1435
        custom_tooltip = { text = multiple_ingredient_option_available_tt }
        custom_tooltip = { text = EVTOPTB_MNM_1435_TT }

        random_list = {
        	60 = {
        		modifier = { learning = 10 factor = 1.2 }
        		modifier = { learning = 12 factor = 1.2 }
        		modifier = { learning = 14 factor = 1.2 }
        		modifier = { learning = 16 factor = 1.2 }
        		modifier = { learning = 18 factor = 1.2 }
        		modifier = {
        			factor = 1.1
        			has_selected_herb_ingredient_1_trigger = yes
        		}
        		modifier = {
        			factor = 1.1
        			has_selected_herb_ingredient_2_trigger = yes
        		}
        		modifier = {
        			factor = 1.1
        			has_selected_animal_part_ingredient_1_trigger = yes
        		}
        		modifier = {
        			factor = 1.1
        			has_selected_animal_part_ingredient_2_trigger = yes
        		}
        		modifier = {
        			factor = 1.5
        			selected_ingredient_is_sleep_inducing_trigger = yes
        		}
        		custom_tooltip = { text = EVTOPTX_MNM_1435_SUCCESS_TT character_event = { id = MNM.1436 days = 7 } }
        	}
        	40 = {
        		modifier = { event_target:infiltration_target = { has_character_flag = hidden_lab } factor = 1.2 }
        		modifier = { event_target:infiltration_target = { has_character_flag = very_hidden_lab } factor = 1.5 }
        		custom_tooltip = { 
	        		text = EVTOPTX_MNM_1435_FAIL_TT
	        		hidden_effect = {
		        		random_list = {
		        			50 = {
		        				character_event = { id = MNM.1436 days = 7 } #You get deteced later, but continue for now
		        				set_character_flag = guards_wake_up
		        			}
		        			50 = { 
		        				character_event = { id = MNM.1437 days = 7 } #Hard fail
		        			}
		        		}
	        		}
	        	}
        	}
        }

        destroy_selected_ingredient_1_and_2_effect = yes

        trigger = {
        	any_artifact = {
        		count = 2
        		has_artifact_flag = ingredient
        	}
        }
    }

    #Make a sleeping potion (mild effect)
    option = {
    	tooltip_info = yes
        name = EVTOPTB_MNM_1435_single_ingredient
        custom_tooltip = { text = ingredient_option_available_tt }
        custom_tooltip = { text = EVTOPTB_MNM_1435_TT }

        random_list = {
        	50 = {
        		modifier = { learning = 10 factor = 1.2 }
        		modifier = { learning = 12 factor = 1.2 }
        		modifier = { learning = 14 factor = 1.2 }
        		modifier = { learning = 16 factor = 1.2 }
        		modifier = { learning = 18 factor = 1.2 }
         		modifier = {
        			factor = 1.2
        			selected_ingredient_is_sleep_inducing_trigger = yes
        		}
        		custom_tooltip = { text = EVTOPTX_MNM_1435_SUCCESS_TT character_event = { id = MNM.1436 days = 7 } }
        	}
        	50 = {
        		modifier = { event_target:infiltration_target = { has_character_flag = hidden_lab } factor = 1.2 }
        		modifier = { event_target:infiltration_target = { has_character_flag = very_hidden_lab } factor = 1.5 }
        		custom_tooltip = { 
	        		text = EVTOPTX_MNM_1435_FAIL_TT
	        		hidden_effect = {
		        		random_list = {
		        			50 = {
		        				character_event = { id = MNM.1436 days = 7 } #You get deteced later, but continue for now
		        				set_character_flag = guards_wake_up
		        			}
		        			50 = { 
		        				character_event = { id = MNM.1437 days = 7 } #Hard fail
		        			}
		        		}
	        		}
	        	}
        	}
        }

        destroy_selected_ingredient_1_effect = yes

        trigger = {
        	any_artifact = {
        		has_artifact_flag = ingredient
        	}
        }
    }
    
    #Distraction
    option = {
        name = EVTOPTC_MNM_1435
        custom_tooltip = { text = EVTOPTC_MNM_1435_TT }

        random_list = {
        	60 = {
        		modifier = { FROM = { intrigue = 10 } factor = 1.2 }
        		modifier = { FROM = { intrigue = 12 } factor = 1.2 }
        		modifier = { FROM = { intrigue = 14 } factor = 1.2 }
        		modifier = { FROM = { intrigue = 16 } factor = 1.2 }
        		modifier = { FROM = { intrigue = 18 } factor = 1.2 }
        		custom_tooltip = { text = EVTOPTX_MNM_1435_SUCCESS_TT character_event = { id = MNM.1438 days = 7 } }
        	}
        	40 = {
        		modifier = { event_target:infiltration_target = { has_character_flag = hidden_lab } factor = 1.2 }
        		modifier = { event_target:infiltration_target = { has_character_flag = very_hidden_lab } factor = 1.5 }
        		custom_tooltip = { 
	        		text = EVTOPTX_MNM_1435_FAIL_TT
	        		hidden_effect = {
		        		random_list = {
		        			50 = { 
		        				character_event = { id = MNM.1438 days = 7 } #You get deteced later, but continue for now
		        				set_character_flag = distraction_failed
		        			}
		        			50 = { 
		        				character_event = { id = MNM.1439 days = 7 } #Hard fail
		        			}
		        		}
	        		}
	        	}
        	}
        }
    }
    
    #Bad idea
    option = {
        name = EVTOPTD_MNM_1435
        custom_tooltip = { text = EVTOPTD_MNM_1435_TT }
        clr_quest = { id = quest_hermetics_infiltrate_laboratory failure = yes }
        reverse_opinion = {
        	who = FROM
        	modifier = opinion_very_disappointed
        	years = 10
        }
        hidden_effect = {
			FROM = { remove_opinion = { who = ROOT modifier = opinion_infiltration_companion } }
        }
    }

    after = {
    	remove_selection_of_ingredients_effect = yes
    }
}

#The sleeping potion worked/you bribed the guards
character_event = {
    id = MNM.1436
    picture = GFX_evt_drunk
    border = GFX_event_normal_frame_intrigue

	trigger = { has_quest = quest_hermetics_infiltrate_laboratory }

    desc = {
    	trigger = { has_character_flag = bribed_guards }
    	text = EVTDESC_MNM_1436_A
    	picture = GFX_evt_shady_meeting
    }
    desc = {
    	trigger = { NOT = { has_character_flag = bribed_guards } }
    	text = EVTDESC_MNM_1436_B
    	picture = GFX_evt_drunk
    }

    is_triggered_only = yes
    
    #You destroy, I will steal
    option = { 
        name = EVTOPTA_MNM_1436
        custom_tooltip = { text = EVTOPTA_MNM_1436_TT }

        hidden_effect = {
        	if = {
        		limit = { 
        			OR = {
        				has_character_flag =  guards_wake_up
	        			has_character_flag =  distraction_failed 
        			}
        		}
        		set_character_flag = caught_stealing
        		character_event = { id = MNM.1440 days = 25 } #Guards catch you stealing
        	}
        	if = {
        		limit = { 
        			NOR = {
	        			has_character_flag =  guards_wake_up
	        			has_character_flag =  distraction_failed 
	        		}
        		}
        		character_event = { id = MNM.1441 days = 25 } #You steal
        		event_target:infiltration_companion = { character_event = { id = MNM.1445 days = 14 } }
        	}
        }
    }

    #I destroy, you steal
    option = {
        name = EVTOPTB_MNM_1436
        custom_tooltip = { text = EVTOPTA_MNM_1436_TT }

        hidden_effect = {
        	if = {
        		limit = { 
        			OR = {
        				has_character_flag =  guards_wake_up
	        			has_character_flag =  distraction_failed 
        			}
        		}
        		set_character_flag = caught_destroying
        		character_event = { id = MNM.1440 days = 25 } #Guards catch you destroying
        	}
        	if = {
        		limit = { 
        			NOR = {
	        			has_character_flag =  guards_wake_up
	        			has_character_flag =  distraction_failed 
	        		}
        		}
        		character_event = { id = MNM.1443 days = 25 } #You destroy
        		event_target:infiltration_companion = { character_event = { id = MNM.1447 days = 14 } }
        	}
        }
    }
    
    #We steal
    option = {
        name = EVTOPTC_MNM_1436
        custom_tooltip = { text = EVTOPTC_MNM_1436_TT }

        hidden_effect = {
        	if = {
        		limit = { 
        			OR = {
        				has_character_flag =  guards_wake_up
	        			has_character_flag =  distraction_failed 
        			}
        		}
        		set_character_flag = caught_stealing
        		character_event = { id = MNM.1440 days = 25 } #Guards catch you stealing
        	}
        	if = {
        		limit = { 
        			NOR = {
	        			has_character_flag =  guards_wake_up
	        			has_character_flag =  distraction_failed 
	        		}
        		}
        		character_event = { id = MNM.1441 days = 25 } #You steal
        	}
        }
    }
    
    #We destroy
    option = {
        name = EVTOPTD_MNM_1436
        custom_tooltip = { text = EVTOPTC_MNM_1436_TT }

        hidden_effect = {
        	if = {
        		limit = { 
        			OR = {
        				has_character_flag =  guards_wake_up
	        			has_character_flag =  distraction_failed 
        			}
        		}
        		set_character_flag = caught_destroying
        		character_event = { id = MNM.1440 days = 25 } #Guards catch you destroying
        	}
        	if = {
        		limit = { 
        			NOR = {
	        			has_character_flag =  guards_wake_up
	        			has_character_flag =  distraction_failed 
	        		}
        		}
        		character_event = { id = MNM.1443 days = 25 } #You destroy
        	}
        }
    }

    after = { hidden_effect = { clr_character_flag = bribed_guards } } 
}

#You fail to make a sleeping potion
character_event = {
    id = MNM.1437
    desc = EVTDESC_MNM_1437
    picture = GFX_evt_quarrel
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes

    trigger = { has_quest = quest_hermetics_infiltrate_laboratory }

    option = { 
        name = EVTOPTA_MNM_1437

        clr_quest = { id = quest_hermetics_infiltrate_laboratory failure = yes }
        reverse_opinion = {
        	who = event_target:infiltration_companion
        	modifier = opinion_very_disappointed
        	years = 10
        }
        hidden_effect = {
			event_target:infiltration_companion = { remove_opinion = { who = ROOT modifier = opinion_infiltration_companion } }
        }
    }
}

#The distraction is successful
character_event = {
    id = MNM.1438
    desc = EVTDESC_MNM_1438
    picture = GFX_evt_shadowy_cabal
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes

	trigger = { has_quest = quest_hermetics_infiltrate_laboratory }

    #Steal
    option = { 
        name = EVTOPTA_MNM_1438

        hidden_effect = {
        	if = {
        		limit = { 
        			OR = {
        				has_character_flag =  guards_wake_up
	        			has_character_flag =  distraction_failed 
        			}
        		}
        		set_character_flag = caught_stealing
        		character_event = { id = MNM.1440 days = 25 } #Guards catch you stealing
        	}
        	if = {
        		limit = { 
        			NOR = {
	        			has_character_flag =  guards_wake_up
	        			has_character_flag =  distraction_failed 
	        		}
        		}
        		character_event = { id = MNM.1441 days = 25 } #You steal
        	}
        }
    }

    #Destroy
    option = { 
        name = EVTOPTB_MNM_1438

        hidden_effect = {
        	if = {
        		limit = { 
        			OR = {
        				has_character_flag =  guards_wake_up
	        			has_character_flag =  distraction_failed 
        			}
        		}
        		set_character_flag = caught_destroying
        		character_event = { id = MNM.1440 days = 25 } #Guards catch you destroying
        	}
        	if = {
        		limit = { 
        			NOR = {
	        			has_character_flag =  guards_wake_up
	        			has_character_flag =  distraction_failed 
	        		}
        		}
        		character_event = { id = MNM.1443 days = 25 } #You destroy
        	}
        }
    }
}

#The diversion fails
character_event = {
    id = MNM.1439
    desc = EVTDESC_MNM_1439
    picture = GFX_evt_quarrel
    border = GFX_event_normal_frame_intrigue

	trigger = { has_quest = quest_hermetics_infiltrate_laboratory }

    is_triggered_only = yes

    option = { 
        name = EVTOPTA_MNM_1439

        clr_quest = { id = quest_hermetics_infiltrate_laboratory failure = yes }
        hidden_effect = {
			event_target:infiltration_companion = { remove_opinion = { who = ROOT modifier = opinion_infiltration_companion } }
        }
    }
}

#You get caught
character_event = {
    id = MNM.1440
    picture = GFX_evt_into_the_dungeon 
    border = GFX_event_normal_frame_intrigue

	trigger = { has_quest = quest_hermetics_infiltrate_laboratory }

    desc = {
    	trigger = {
    		has_character_flag = guards_wake_up
    		has_character_flag = caught_destroying
    	}
    	text = EVTDESC_MNM_1440_A
    }
    desc = {
    	trigger = {
    		OR = {
	    		AND = {
		    		has_character_flag = distraction_failed
		    		has_character_flag = caught_destroying
	    		}
	    		FROM = { has_character_flag = bad_theft }
	    	}
    	}
    	text = EVTDESC_MNM_1440_B
    }
    desc = {
    	trigger = {
    		has_character_flag = guards_wake_up
    		has_character_flag = caught_stealing
    	}
    	text = EVTDESC_MNM_1440_C
    }
    desc = {
    	trigger = {
    		has_character_flag = distraction_failed
    		has_character_flag = caught_stealing
    	}
    	text = EVTDESC_MNM_1440_D
    }

    is_triggered_only = yes

    option = { 
        name = EVTOPTA_MNM_1440


        event_target:infiltration_target = {
        	if = {
	        	limit = { is_landed = yes }
	        	ROOT = { imprison = PREV }
	        	if = {
	        		limit = { event_target:infiltration_companion = { ai = yes } }
	        		event_target:infiltration_companion = { imprison = PREV }
	        	}
	        }

	        if = {
	        	limit = { is_landed = no }
	        	host = {
		        	ROOT = { imprison = PREV }
		        	if = {
		        		limit = { event_target:infiltration_companion = { ai = yes } }
		        		event_target:infiltration_companion = { imprison = PREV }
		        	}
	        	}
	        }
        }

        reverse_opinion = {
        	who = event_target:infiltration_target
        	modifier = opinion_thief
        	years = 20 
        }
        hidden_effect = {
        	event_target:infiltration_companion = {
        		reverse_opinion = {
		        	who = event_target:infiltration_target
		        	modifier = opinion_thief
		        	years = 20 
		        }
        	}
        }

        hidden_effect = {
        	clr_character_flag = distraction_failed
        	clr_character_flag = guards_wake_up
        	clr_character_flag = caught_stealing
        	clr_character_flag = caught_destroying
        	FROM  = { clr_character_flag = bad_theft }
        }
        clr_quest = { id = quest_hermetics_infiltrate_laboratory failure = yes }
        hidden_effect = {
        	event_target:infiltration_target = { character_event = { id = MNM.1451 days = 7 } }
			event_target:infiltration_companion = { remove_opinion = { who = ROOT modifier = opinion_infiltration_companion } }
        }
    }
}

#The captor decides what to do with you
character_event = {
    id = MNM.1451
    desc = EVTDESC_MNM_1451
    picture = GFX_evt_catching_heretic		
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes

    #Trade secrets for freedom
    option = { 
    	trigger = { 
    		FROM = { 
				has_society_currency_medium_trigger = yes 
				prisoner = yes
			} 
		}
        name = EVTOPTA_MNM_1451

        tooltip = {
        	random_list = {
        		60 = {
        			modifier = { trait = craven factor = 1.5 }
        			add_society_currency_major_effect = yes
        		}
        		40 = {
        			modifier = {
		        		OR = {
		        			trait = greedy
		        			trait = ambitious
		        			trait = wroth
		        			trait = paranoid
		        		}
		        		factor = 2
		        	}
        			custom_tooltip = { text = EVTOPTA_MNM_1451_FAIL_TT }
        		}

        	}
        }

        hidden_effect = { FROM = { character_event = { id = MNM.1452 } } }

        ai_chance = {
        	factor = 60
        	modifier = {
        		OR = {
        			trait = greedy
        			trait = ambitious
        			learning = 14
        		}
        		factor = 2
        	}
        }
    }

    #Let them rot
    option = {
        name = EVTOPTB_MNM_1451

        if = {
        	limit = { NOT = { is_rival = FROM } }
        	tooltip = { add_rival = FROM }
        }
        if = {
        	limit = { NOT = { is_rival = event_target:infiltration_companion } }
        	tooltip = { add_rival = event_target:infiltration_companion }
        }

        hidden_effect = { FROM = { character_event = { id = MNM.1455 } } }

        ai_chance = {
        	factor = 40
        	modifier = {
        		is_rival = FROM
        		factor = 2
        	}
        }
    }
}

#Give me secrets, I will let you out
character_event = {
    id = MNM.1452
    desc = EVTDESC_MNM_1452
    picture = GFX_evt_catching_heretic			
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes

    trigger = { prisoner = yes }

    #Alright...
    option = { 
        name = EVTOPTA_MNM_1452

        detract_society_currency_medium_effect = yes

        tooltip = { imprison = no }

        hidden_effect = { FROM = { character_event = { id = MNM.1453 days = 3 } } }

        ai_chance = {
        	modifier = { trait = craven factor = 1.5 }
        	factor = 60
        }
    }

    #Never!
    option = {
        name = EVTOPTB_MNM_1452
        custom_tooltip = { text = EVTOPTB_MNM_1452_TT }

        if = {
        	limit = { NOT = { is_rival = FROM } }
        	tooltip = { add_rival = FROM }
        }

        hidden_effect = { FROM = { character_event = { id = MNM.1454 days = 3 } } }

        ai_chance = {
        	modifier = {
        		OR = {
        			trait = greedy
        			trait = ambitious
        			trait = wroth
        			trait = paranoid
        		}
        		factor = 2
        	}
        	factor = 40
        }
    }
}

#Infiltration target get their secrets 
character_event = {
    id = MNM.1453	
    desc = EVTDESC_MNM_1453
    picture = GFX_evt_dark_prayer
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes

    option = { 
        name = EVTOPTA_MNM_1453
       
       	add_society_currency_major_effect = yes

       	FROM = { imprison = no }
    }
}

#Infiltration target is denied
character_event = {
    id = MNM.1454	
    desc = EVTDESC_MNM_1454
    picture = GFX_evt_into_the_dungeon
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes

    option = { 
        name = EVTOPTA_MNM_1454
       
       	if = {
        	limit = { NOT = { is_rival = FROM } }
        	add_rival = FROM
        }
    }
}

#Infiltration target wants you to rot
character_event = {
    id = MNM.1455	
    desc = EVTDESC_MNM_1455
    picture = GFX_evt_catching_heretic
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes

    option = { 
        name = EVTOPTA_MNM_1455
       
       	if = {
        	limit = { NOT = { is_rival = FROM } }
        	add_rival = FROM
        }
    }
}

#You steal
character_event = {
    id = MNM.1441
    picture = GFX_evt_library
    border = GFX_event_normal_frame_intrigue

    desc = {
    	trigger = { has_character_flag = great_theft }
    	text = EVTDESC_MNM_1441_A
    }
    desc = {
    	trigger = { has_character_flag = good_theft }
    	text = EVTDESC_MNM_1441_B
    }
    desc = {
    	trigger = { has_character_flag = ok_theft }
    	text = EVTDESC_MNM_1441_C
    }

    is_triggered_only = yes
    hide_from = yes

    trigger = { has_quest = quest_hermetics_infiltrate_laboratory }

    immediate = {
    	random_list = {
    		33 = { #Great theft
    			trigger = { 
    				event_target:infiltration_target = { 
    					any_artifact = { 
    						has_artifact_flag = hermetics 
    						has_artifact_flag = text
    					}
    				}
    			}
    			modifier = { learning = 12 factor = 1.2 }
    			modifier = { learning = 13 factor = 1.2 }
    			modifier = { learning = 16 factor = 1.2 }
    			modifier = { learning = 18 factor = 1.2 }
    			modifier = { event_target:infiltration_target = { ai = no } factor = 0.5 }
    			set_character_flag = great_theft
    		}
    		33 = { #Good theft
    			trigger = {
    				event_target:infiltration_target = { 
		    			any_artifact = { 
							has_artifact_flag = hermetics
							has_artifact_flag = ingredient
						}
					}
    			}
    			modifier = { learning = 10 factor = 1.2 }
    			modifier = { learning = 12 factor = 1.1 }
    			modifier = { learning = 13 factor = 1.1 }
    			modifier = { learning = 16 factor = 1.1 }
    			modifier = { learning = 18 factor = 1.1 }
    			set_character_flag = good_theft
    		}
    		33 = { #Ok theft
    			modifier = { event_target:infiltration_target = { has_character_flag = hidden_lab } factor = 1.2 }
        		modifier = { event_target:infiltration_target = { has_character_flag = very_hidden_lab } factor = 1.5 }
    			set_character_flag = ok_theft
    		}
    	}
    }

    #Great theft
    option = { 
    	trigger = {  has_character_flag = great_theft }
        name = EVTOPTA_MNM_1441

	    custom_tooltip = { text = EVTOPTA_MNM_1441_steal_text }
     
    	if = {
    		limit = { 
    			event_target:infiltration_target = {
        			any_artifact = {
        				has_artifact_flag = hermetics
						has_artifact_flag = ingredient
					}
				}
    		}
    		custom_tooltip = { text = EVTOPTA_MNM_1441_steal_ingredient }
        }

        #Money and knowledge
        transfer_scaled_wealth = { from = event_target:infiltration_target value = 0.5 min = 50 }
        add_society_currency_massive_effect = yes
    }

    #Good theft
    option = {
    	trigger = {  has_character_flag = good_theft }
        name = EVTOPTA_MNM_1441

        #You get artifacts
	    custom_tooltip = { text = EVTOPTA_MNM_1441_steal_ingredient }

        #Money and knowledge
        transfer_scaled_wealth = { from = event_target:infiltration_target value = 0.25 min = 25 }
        add_society_currency_major_effect = yes
    }
    
    option = {
    	trigger = {  has_character_flag = ok_theft }
        name = EVTOPTC_MNM_1441

        #Money and knowledge
        transfer_scaled_wealth = { from = event_target:infiltration_target value = 0.1 min = 10 }
        add_society_currency_medium_effect = yes
    }

    after = {
    	hidden_effect = {
    		event_target:infiltration_target = { character_event = { id = MNM.1442 } }
    		character_event = { id = MNM.1450 days = 40 }
    	}
    }
}

#Person who gets stolen from gets notified
character_event = {
    id = MNM.1442
    picture = GFX_evt_burning_house
    border = GFX_event_normal_frame_intrigue

    desc = {
    	trigger = { FROM = { has_character_flag = great_theft } }
    	text = EVTDESC_MNM_1442_A
    }
    desc = {
    	trigger = { FROM = { has_character_flag = good_theft } }
    	text = EVTDESC_MNM_1442_B
    }
    desc = {
    	trigger = { FROM = { has_character_flag = ok_theft } }
    	text = EVTDESC_MNM_1442_C
    }

    hide_from = yes
    is_triggered_only = yes


    option = { 
        name = CURSES

        #Artifacts get stolen
        if = { 
        	limit = { FROM = { has_character_flag = great_theft } } 
        	random_artifact = {
	    		limit = {
	    			has_artifact_flag = hermetics 
					has_artifact_flag = text
	    		}

	    		tooltip = { destroy_artifact = yes }
	    		hidden_effect = {
		    		transfer_artifact = {
		    			from = ROOT
		    			to = FROM
		    		}
	    		}
	    	}
        }

        if = { 
        	limit = { 
        		FROM = {
        			OR = {
        				has_character_flag = great_theft
        				has_character_flag = good_theft 
        			} 
        		}
        	}
        	if = {
	    		limit = { 
	    			any_artifact = {
	    				has_artifact_flag = hermetics
						has_artifact_flag = ingredient
					}
	    		}
	    		random_artifact = {
	        		limit = {
	        			has_artifact_flag = hermetics 
	    				has_artifact_flag = ingredient
	        		}
	        		tooltip = { destroy_artifact = yes }
		    		hidden_effect = {
			    		transfer_artifact = {
			    			from = ROOT
			    			to = FROM
			    		}
		    		}
	        	}
	    	}
        }

       	#Money
       	if = {
       		limit = { FROM = { has_character_flag = great_theft } }
       		tooltip = { scaled_wealth = { value = -0.5 min = -50 } }
       	}
       	if = {
       		limit = { FROM = { has_character_flag = good_theft } }
       		tooltip = { scaled_wealth = { value = -0.25 min = -25 } }
       	}
       	if = {
       		limit = { FROM = { has_character_flag = ok_theft } }
       		tooltip = { scaled_wealth = { value = -0.1 min = -10 } }
       	}

       	hidden_effect = {
       		FROM = { 
       			clr_character_flag = great_theft
       			clr_character_flag = good_theft
       			clr_character_flag = ok_theft
       		}
       	}
    }
}

#You destroy
character_event = {
    id = MNM.1443
    picture = GFX_evt_burning_house
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    hide_from = yes

    desc = {
    	trigger = { has_character_flag = lab_destruction }
    	text = EVTDESC_MNM_1443_A
    }
    desc = {
    	trigger = { has_character_flag = lab_damage }
    	text = EVTDESC_MNM_1443_B
    }
    desc = {
    	trigger = { has_character_flag = lab_explosion_death }
    	text = EVTDESC_MNM_1443_C
    }
    
    trigger = { has_quest = quest_hermetics_infiltrate_laboratory }

    immediate = {
    	random_list = {
	    	40 = { #Total destruction
	    		trigger = { event_target:infiltration_target = { has_character_flag = built_laboratory } }
	    		modifier = { learning = 12 factor = 1.2 }
				modifier = { learning = 13 factor = 1.2 }
				modifier = { learning = 16 factor = 1.2 }
				modifier = { learning = 18 factor = 1.2 }
				set_character_flag = lab_destruction
	    	}
	    	55 = { #Major damage
	    		modifier = { learning = 10 factor = 1.2 }
				modifier = { learning = 12 factor = 1.1 }
				modifier = { learning = 13 factor = 1.1 }
				modifier = { learning = 16 factor = 1.1 }
				modifier = { learning = 18 factor = 1.1 }
				set_character_flag = lab_damage
	    	}
	    	5 = { #You die in an accident
	    		modifier = { event_target:infiltration_target = { has_character_flag = hidden_lab } factor = 1.2 }
	        	modifier = { event_target:infiltration_target = { has_character_flag = very_hidden_lab } factor = 1.5 }
	    		trigger = { event_target:infiltration_target = { has_character_flag = built_laboratory } }
	    		modifier = { NOT = { learning = 10 } factor = 1.5 }
	    		modifier = { NOT = { learning = 8 } factor = 2 }
	    		modifier = { NOT = { learning = 6 } factor = 2 }
	    		set_character_flag = lab_explosion_death
	    	}
	    }
    }

    option = { 
    	trigger = { has_character_flag = lab_destruction }
        name = EVTOPTA_MNM_1443
        
        event_target:infiltration_target = {
        	tooltip = {
        		trigger_switch = {
        			on_trigger = has_character_modifier
        			cheap_laboratory 	= { remove_character_modifier = cheap_laboratory }
        			normal_laboratory 	= { remove_character_modifier = normal_laboratory }
        			good_laboratory 	= { remove_character_modifier = good_laboratory }
        			great_laboratory 	= { remove_character_modifier = great_laboratory }
        			best_laboratory 	= { remove_character_modifier = best_laboratory }
        		}
        		destroy_all_ingredients_effect = yes
        	}        	
        }

        add_society_currency_major_effect = yes
    }

    option = {
    	trigger = { has_character_flag = lab_damage }
        name = EVTOPTA_MNM_1443

        tooltip = {
        	event_target:infiltration_target = {
        		scaled_wealth = { value = -0.3 min = -30 }
        		destroy_random_ingredients_effect = yes
        	}
        }

        add_society_currency_medium_effect = yes
    }
    
    option = {
    	trigger = { has_character_flag = lab_explosion_death }
        name = EVTOPTC_MNM_1443
        death = { death_reason = death_accident }
    }

    after = {
    	hidden_effect = {
    		event_target:infiltration_target = { character_event = { id = MNM.1444 } }
    		character_event = { id = MNM.1450 days = 40 }
    	}
    }
}

#Infiltration target gets notified of destroyed lab
character_event = {
    id = MNM.1444
    picture = GFX_evt_burning_house
    border = GFX_event_normal_frame_intrigue

    desc = {
    	trigger = { FROM = { has_character_flag = lab_destruction } }
    	text = EVTDESC_MNM_1444_A
    }
    desc = {
    	trigger = { FROM = { has_character_flag = lab_damage } }
    	text = EVTDESC_MNM_1444_B
    }
    desc = {
    	trigger = { 
    		FROM = { 
    			NOR = {
    				has_character_flag = lab_destruction
    				has_character_flag = lab_damage
    			}
    		}
    	}
    	text = EVTDESC_MNM_1444_C
    }

    hide_from = yes

    is_triggered_only = yes
    
    option = { 
    	trigger = { 
    		FROM = { 
    			OR = {
    				has_character_flag = lab_destruction
    				has_character_flag = lab_damage
    			}
    		}
    	}
        name = CURSES
        
        if = {
        	limit = { FROM = { has_character_flag = lab_destruction } } 
        	destroy_all_ingredients_effect = yes
        	trigger_switch = {
    			on_trigger = has_character_modifier
    			cheap_laboratory 	= { remove_character_modifier = cheap_laboratory }
    			normal_laboratory 	= { remove_character_modifier = normal_laboratory }
    			good_laboratory 	= { remove_character_modifier = good_laboratory }
    			great_laboratory 	= { remove_character_modifier = great_laboratory }
    			best_laboratory 	= { remove_character_modifier = best_laboratory }
    		}
    		hidden_effect = {
    			clr_character_flag = built_laboratory
    			clr_character_flag = hidden_lab
    			clr_character_flag = very_hidden_lab
    		}
        }

        if = {
        	limit = { FROM = { has_character_flag = lab_damage } } 
        	scaled_wealth = { value = -0.3 min = -30 }
        	destroy_random_ingredients_effect = yes
        }
    }

    option = { 
        trigger = { 
    		FROM = { 
    			NOR = {
    				has_character_flag = lab_destruction
    				has_character_flag = lab_damage
    			}
    		}
    	}
    	name = EVTOPTB_MNM_1444
        FROM = { clr_character_flag = lab_explosion_death }
    }
   
   	after = {	
   		hidden_effect = {
	   		FROM = {
	   			clr_character_flag = lab_destruction
	   			clr_character_flag = lab_damage
	   		}
   		}
  	}
}

#Companion attempts to steal
character_event = {
    id = MNM.1445
    hide_window = yes
    is_triggered_only = yes

    trigger = { FROM = { has_quest = quest_hermetics_infiltrate_laboratory } }

    immediate = {
    	random_list = {
			40 = { #Good theft
				trigger = {
	    			any_artifact = { 
						has_artifact_flag = hermetics
						has_artifact_flag = ingredient
					}
				}
				modifier = { learning = 10 factor = 1.2 }
				modifier = { learning = 12 factor = 1.1 }
				modifier = { learning = 13 factor = 1.1 }
				modifier = { learning = 16 factor = 1.1 }
				modifier = { learning = 18 factor = 1.1 }
				set_character_flag = good_theft
				FROM = { character_event = { id = MNM.1446 days = 20 } }
			}
			40 = { #Ok theft
				set_character_flag = ok_theft
				FROM = { character_event = { id = MNM.1446 days = 20 } }
			}
			20 = { #Bad theft
				modifier = { event_target:infiltration_target = { has_character_flag = hidden_lab } factor = 1.2 }
        		modifier = { event_target:infiltration_target = { has_character_flag = very_hidden_lab } factor = 1.5 }
				modifier = { NOT = { learning = 10 } factor = 1.5 }
				modifier = { NOT = { learning = 8 } factor = 2 }
				modifier = { NOT = { intrigue = 10 } factor = 1.5 }
				modifier = { NOT = { intrigue = 8 } factor = 2 }
				set_character_flag = bad_theft
				FROM = { character_event = { id = MNM.1440 } }
			}
		}
    }
}

#Companion steal attempt good/ok outcome
character_event = {
    id = MNM.1446
    picture = GFX_evt_library
    border = GFX_event_normal_frame_intrigue

    desc = {
    	trigger = { FROM = { has_character_flag = good_theft } }
    	text = EVTDESC_MNM_1446_A
    }
    desc = {
    	trigger = { FROM = { has_character_flag = ok_theft } }
    	text = EVTDESC_MNM_1446_B
    }

    is_triggered_only = yes

    trigger = { has_quest = quest_hermetics_infiltrate_laboratory }

    option = { 
    	trigger = { FROM = { has_character_flag = good_theft } }
        name = EVTOPTA_MNM_1446

        add_artifact = ingredient_metal_exotic5
       	add_society_currency_minor_effect = yes

       	hidden_effect = { FROM = { clr_character_flag = good_theft } }
    }

    option = {
    	trigger = { FROM = { has_character_flag = ok_theft } }
        name = EVTOPTA_MNM_1446

        add_society_currency_minor_effect = yes
        hidden_effect = { FROM = { clr_character_flag = ok_theft } }
    }
}

#Companion attempts to destroy
character_event = {
    id = MNM.1447
    hide_window = yes
    is_triggered_only = yes

    trigger = { FROM = { has_quest = quest_hermetics_infiltrate_laboratory } }

    immediate = {
    	random_list = {
			90 = { #Lab damage
				modifier = { learning = 10 factor = 1.2 }
				modifier = { learning = 12 factor = 1.1 }
				modifier = { learning = 13 factor = 1.1 }
				modifier = { learning = 16 factor = 1.1 }
				modifier = { learning = 18 factor = 1.1 }
				FROM = { character_event = { id = MNM.1448 days = 20 } }
			}
			10 = { #They die
				modifier = { event_target:infiltration_target = { has_character_flag = hidden_lab } factor = 1.2 }
        		modifier = { event_target:infiltration_target = { has_character_flag = very_hidden_lab } factor = 1.5 }
				modifier = { NOT = { learning = 10 } factor = 1.5 }
				modifier = { NOT = { learning = 8 } factor = 2 }
				modifier = { NOT = { intrigue = 10 } factor = 1.5 }
				modifier = { NOT = { intrigue = 8 } factor = 2 }
				FROM = { character_event = { id = MNM.1449 } }
			}
		}
    }
}

#Companion manages to damage lab
character_event = {
    id = MNM.1448
    desc = EVTDESC_MNM_1448
    picture = GFX_evt_burning_house
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    trigger = { has_quest = quest_hermetics_infiltrate_laboratory }

    option = { 
        name = EVTOPTA_MNM_1448

        add_society_currency_minor_effect = yes
    }
}

#Companion dies in an explotion
character_event = {
    id = MNM.1449
    desc = EVTDESC_MNM_1449
    picture = GFX_evt_burning_house
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    trigger = { has_quest = quest_hermetics_infiltrate_laboratory }

    option = { 
        name = EVTOPTA_MNM_1449

        FROM = { death = { death_reason = death_accident } }

        clr_quest = { id = quest_hermetics_infiltrate_laboratory failure = yes }
        hidden_effect = {
			event_target:infiltration_companion = { remove_opinion = { who = ROOT modifier = opinion_infiltration_companion } }
        }
    }
}

#You escape and mission is complete
character_event = {
    id = MNM.1450
    desc = EVTDESC_MNM_1450
    picture = GFX_evt_burning_house
    border = GFX_event_normal_frame_intrigue

    is_triggered_only = yes
    
    trigger = { has_quest = quest_hermetics_infiltrate_laboratory }

    option = { 
        name = EVTOPTA_MNM_1450

        clr_quest = quest_hermetics_infiltrate_laboratory 
		sound_effect = hermetic_society_perform_experiment
        hidden_effect = {
			event_target:infiltration_companion = { remove_opinion = { who = ROOT modifier = opinion_infiltration_companion } }
        }

        if = {
        	limit = {
        		opinion = { who = event_target:infiltration_companion value = 40 }
        		reverse_opinion = { who = event_target:infiltration_companion value = 40 }
        		NOT = { is_friend = event_target:infiltration_companion }
        	}
        	add_friend = event_target:infiltration_companion
        	break = yes
        }
        reverse_opinion = {
        	who = event_target:infiltration_companion
        	modifier = opinion_accomplice
        	years = 10 
        }
        hidden_effect = {
        	opinion = {
	        	who = event_target:infiltration_companion
	        	modifier = opinion_accomplice
	        	years = 10 
	        }
        }
    }
}

#Clears flags from infiltration target
character_event = {
    id = MNM.1456
    hide_window = yes
    is_triggered_only = yes
    immediate = { 
    	clr_character_flag = infiltration_rival
    	clr_character_flag = infiltration_mutual_dislike
    	clr_character_flag = infiltration_rich
    }
}

############
# POWERS
############
####################### Start of Scrying events #######################
######## Power: Perform Scrying - what do you want to look for? #######
character_event = {
    id = MNM.1200
    picture = GFX_evt_dark_prayer
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_dlc = "Mystics"
    	has_an_omen_modifier_trigger = no
    }

    desc = {
    	text = EVTDESC_MNM_1200_A
    	trigger = {	NOT = { any_artifact = { has_artifact_flag = ingredient	} } }
    }
    desc = {
    	text = EVTDESC_MNM_1200_B
    	trigger = {	any_artifact = { has_artifact_flag = ingredient	} }
    }

    immediate = {
    	if = {
    		limit = {
    			any_artifact = {
					has_artifact_flag = ingredient
				}
    		}
    		select_random_hermetic_ingredient_effect = yes
    	}
    }

    option = { # I want to know about battles to come
        name = EVTOPTA_MNM_1200
        set_character_flag = battle_focused_scrying_flag
    }
    option = { # I want to know where my relationships will lead
        name = EVTOPTB_MNM_1200
        set_character_flag = relationship_focused_scrying_flag
    }
    option = { # I want to find out how to increase my power
        name = EVTOPTC_MNM_1200
        set_character_flag = power_hungry_scrying_flag
    }

    option = { # I am gonna throw some ingredients into the water...
    	tooltip_info = yes

    	custom_tooltip = { text = ingredient_option_available_tt }
    	custom_tooltip = { text = EVTOPTD_MNM_1200_tt }
        name = {
        	text = EVTOPTD_MNM_1200_herb
        	trigger = {
        		any_artifact = {
        			has_artifact_flag = selected_ingredient
        			is_ingredient_herb_trigger = yes
        		}
        	}
        }
        name = {
        	text = EVTOPTD_MNM_1200_animal_part
        	trigger = {
        		any_artifact = {
        			has_artifact_flag = selected_ingredient
        			is_ingredient_animal_part_trigger = yes
        		}
        	}
        }
        name = {
        	text = EVTOPTD_MNM_1200_powder
        	trigger = {
        		any_artifact = {
        			has_artifact_flag = selected_ingredient
        			is_ingredient_powder_trigger = yes
        		}
        	}
        }
        name = {
        	text = EVTOPTD_MNM_1200_liquid
        	trigger = {
        		any_artifact = {
        			has_artifact_flag = selected_ingredient
        			is_ingredient_liquid_trigger = yes
        		}
        	}
        }
        hidden_effect = {
	        random_list = {
	        	10 = {
	        		set_character_flag = battle_focused_scrying_flag
	        	}
	        	10 = {
	        		set_character_flag = relationship_focused_scrying_flag
	        	}
	        	10 = {
	        		set_character_flag = power_hungry_scrying_flag
	        	}
	        }
	        set_character_flag = used_ingredient_flag
        }
        destroy_selected_ingredient_1_effect = yes

        ai_chance = { #AI should use ingredients if they can
			factor = 100
			modifier = {
				factor = 50
				trait = ambitious
			}
		}

        trigger = {
        	any_artifact = { has_artifact_flag = ingredient }
        }
    }

    after = {
    	hidden_effect = {
   			character_event = { id = MNM.1201 days = 5 random = 1 }
	    	remove_selection_of_ingredients_effect = yes
    	}
    }
}

character_event = { # You see something in the water and react well or poorly to it
    id = MNM.1201
    picture = GFX_evt_dark_prayer
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_dlc = "Mystics"
    	has_an_omen_modifier_trigger = no
    	society_member_of = hermetics
    }

    desc = {
    	trigger = { has_character_flag = battle_focused_scrying_flag has_character_flag = desc_variation_A_flag }
    	text = EVTDESC_MNM_1201_BATTLE_A
    }
    desc = {
    	trigger = { has_character_flag = battle_focused_scrying_flag has_character_flag = desc_variation_B_flag }
    	text = EVTDESC_MNM_1201_BATTLE_B
    }
    desc = {
    	trigger = { has_character_flag = battle_focused_scrying_flag has_character_flag = desc_variation_C_flag }
    	text = EVTDESC_MNM_1201_BATTLE_C
    }

    desc = {
    	trigger = { has_character_flag = relationship_focused_scrying_flag has_character_flag = desc_variation_A_flag }
    	text = EVTDESC_MNM_1201_RELATIONSHIP_A
    }
    desc = {
    	trigger = { has_character_flag = relationship_focused_scrying_flag has_character_flag = desc_variation_B_flag }
    	text = EVTDESC_MNM_1201_RELATIONSHIP_B
    }
    desc = {
    	trigger = { has_character_flag = relationship_focused_scrying_flag has_character_flag = desc_variation_C_flag }
    	text = EVTDESC_MNM_1201_RELATIONSHIP_C
    }

    desc = {
    	trigger = { has_character_flag = power_hungry_scrying_flag has_character_flag = desc_variation_A_flag }
    	text = EVTDESC_MNM_1201_POWER_A
    }
    desc = {
    	trigger = { has_character_flag = power_hungry_scrying_flag has_character_flag = desc_variation_B_flag }
    	text = EVTDESC_MNM_1201_POWER_B
    }
    desc = {
    	trigger = { has_character_flag = power_hungry_scrying_flag has_character_flag = desc_variation_C_flag }
    	text = EVTDESC_MNM_1201_POWER_C
    }

    immediate = {
    	random_list = {
    		10 = { set_character_flag = desc_variation_A_flag }
    		10 = { set_character_flag = desc_variation_B_flag }
    		10 = { set_character_flag = desc_variation_C_flag }
    	}
    	random_list = {
    		30 = {
    			modifier = {
					factor = 1.5
    				has_character_flag = used_ingredient_flag
				}
    			set_character_flag = positive_reaction_to_scrying_flag
    		}
    		30 = {
    			set_character_flag = negative_reaction_to_scrying_flag
    		}
    	}
    }
    option = {
        name = EVTOPTA_MNM_1201

		if = { limit = { has_character_flag = battle_focused_scrying_flag }
			add_character_modifier = {
				name = good_battle_omen
				duration = -1
			}
			
		}
		if = { limit = { has_character_flag = relationship_focused_scrying_flag }
			add_character_modifier = {
				name = good_relationship_omen
				duration = -1
			}
		}
		if = { limit = { has_character_flag = power_hungry_scrying_flag }
			add_character_modifier = {
				name = good_power_omen
				duration = -1
			}
		}

		trigger = {
			has_character_flag = positive_reaction_to_scrying_flag
		}
    }
    option = {
        name = EVTOPTB_MNM_1201

		if = { limit = { has_character_flag = battle_focused_scrying_flag }
			add_character_modifier = {
				name = bad_battle_omen
				duration = -1
			}
		}
		if = { limit = { has_character_flag = relationship_focused_scrying_flag }
			add_character_modifier = {
				name = bad_relationship_omen
				duration = -1
			}
		}
		if = { limit = { has_character_flag = power_hungry_scrying_flag }
			add_character_modifier = {
				name = bad_power_omen
				duration = -1
			}
		}

		trigger = {
			has_character_flag = negative_reaction_to_scrying_flag
		}
    }
    after = {
    	hidden_effect = {
			random_list = { # For sending fallbacks, in case nothing else triggers from the omen-modifiers during the next few years
				10 = {
					character_event = { id = MNM.1225 days = 1500 random = 300 }
				}
				10 = {
					character_event = { id = MNM.1226 days = 1500 random = 300 }
				}
				10 = {
					character_event = { id = MNM.1227 days = 1500 random = 300 }
				}
			}
		}
    	clr_character_flag = desc_variation_A_flag
		clr_character_flag = desc_variation_B_flag
		clr_character_flag = desc_variation_C_flag
		clr_character_flag = battle_focused_scrying_flag
		clr_character_flag = relationship_focused_scrying_flag
		clr_character_flag = power_hungry_scrying_flag
		clr_character_flag = used_ingredient_flag
    }
}

character_event = { # Gain a leadership trait (fired from on_combat_pulse)
    id = MNM.1202
    picture = GFX_evt_battle
    border = GFX_event_normal_frame_war
    is_triggered_only = yes

    trigger = {
    	has_dlc = "Mystics"
    	is_alive = yes
    	can_have_more_leadership_traits = yes
    	OR = {
    		NOT = { trait = experimenter }
    		NOT = { trait = unyielding_leader }
    		NOT = { trait = inspiring_leader }
    	}    	
		has_battle_omen_modifier_trigger = yes
    }

    weight_multiplier = {
		days = 1
		modifier = {
			factor = 2.5
			has_character_modifier = good_battle_omen
		}
		modifier = {
			factor = 1.5
			trait = brave
		}
		modifier = {
			factor = 0.5
			trait = craven
		}
		modifier = {
			trait = genius
			factor = 1.5
		}
		modifier = {
			OR = {
				trait = quick
				trait = shrewd
			}
			factor = 1.2
		}
		modifier = {
			factor = 0.9
			has_character_modifier = bad_battle_omen
		}
	}

	desc = {
    	trigger = { has_character_modifier = good_battle_omen }
    	text = EVTDESC_MNM_1202_A
    }
    desc = {
    	trigger = { has_character_modifier = bad_battle_omen }
    	text = EVTDESC_MNM_1202_B
    }
    
	immediate = {
		random_list = {
			10 = {
				trigger = { NOT = { trait = experimenter } }
				set_character_flag = gain_direct_leader
			}
			10 = {
				trigger = { NOT = { trait = unyielding_leader } }
				set_character_flag = gain_unyielding_leader
			}
			10 = {
				trigger = { NOT = { trait = inspiring_leader } }
				set_character_flag = gain_inspiring_leader
			}
		}
	}

	option = { # Gain Direct Leader
        name = EVTOPTA_MNM_1202
		trigger = {	has_character_flag = gain_direct_leader }
		add_trait = experimenter
	}
	option = { # Gain Unyielding
        name = EVTOPTB_MNM_1202
		trigger = { has_character_flag = gain_unyielding_leader }
		add_trait = unyielding_leader
	}
	option = { # Gain Inspiring Leader
		name = EVTOPTC_MNM_1202
		trigger = { has_character_flag = gain_inspiring_leader }
		add_trait = inspiring_leader
	}
	after = {
		if = {
			limit = { has_character_modifier = good_battle_omen }
			upgrade_seer_modifier_effect = yes
    	}
    	if = {
			limit = { has_character_modifier = bad_battle_omen }
			downgrade_seer_modifier_effect = yes
    	}
		remove_scrying_omen_modifiers_effect = yes
		clr_character_flag = gain_direct_leader
		clr_character_flag = gain_unyielding_leader
		clr_character_flag = gain_inspiring_leader
	}
}

character_event = { # Fight goes badly (fired from on_combat_pulse)
    id = MNM.1203
    picture = GFX_evt_battle
    border = GFX_event_normal_frame_war
    is_triggered_only = yes
    
    trigger = {
    	has_dlc = "Mystics"
    	is_alive = yes
    	has_battle_omen_modifier_trigger = yes
    }

    weight_multiplier = {
		days = 1
		modifier = {
			factor = 2
			has_character_modifier = bad_battle_omen
		}
		modifier = {
			factor = 0.9
			has_character_modifier = good_battle_omen
		}
	}

    desc = {
    	trigger = { has_character_modifier = bad_battle_omen }
    	text = EVTDESC_MNM_1203_A
    }
	desc = {
    	trigger = { has_character_modifier = good_battle_omen }
    	text = EVTDESC_MNM_1203_B
    }

	option = { # At least I was right
		name = EVTOPTA_MNM_1203
		upgrade_seer_modifier_effect = yes

		trigger = { has_character_modifier = bad_battle_omen }
	}
	option = { # Curses! Where's the glory in this?!
    	name = EVTOPTB_MNM_1203
		downgrade_seer_modifier_effect = yes

    	trigger = { has_character_modifier = good_battle_omen }
	}

	after = {
		random_list = {
			40 = {
				add_trait_wounded_effect = yes
			}
			40 = {
				modifier = {
					factor = 0
					OR = {
						trait = one_legged
						NOT = { has_dlc = "Reapers" }
					}
				}
				add_trait = one_legged
		
				character_event = { id = RIP.11503 } # Notify one-legged
				if = {
					limit = {
						AND = {
							has_dlc = "Reapers"
							NOT = { trait = severely_injured }
						}
					}
					add_trait = severely_injured
					resolve_severely_injured_effect = yes
				}
			}
			5 = {
				death = { death_reason = death_battle }
			}
		}
		remove_scrying_omen_modifiers_effect = yes
	}
}

character_event = { # A Child is born - you have a good feeling about the kid! (fired from on_birth)
    id = MNM.1204
    picture = GFX_evt_state_diplomacy
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_dlc = "Mystics"
    	is_alive = yes

    	FROM = {
    		is_alive = yes
    		OR = {
	    		is_smart_trigger = yes
	    		is_strong_trigger = yes
    		}
    		NOT = { has_negative_congenital_trigger = yes }
    	}
		has_relationship_omen_modifier_trigger = yes
    }

    immediate = {
    	if = { limit = { has_character_modifier = good_relationship_omen } set_character_flag = omen_opt1 }
    	if = { limit = { has_character_modifier = bad_relationship_omen } set_character_flag = omen_opt2 }
    	remove_scrying_omen_modifiers_effect = yes
    }

	desc = {
    	trigger = { has_character_modifier = good_relationship_omen }
    	text = EVTDESC_MNM_1204_A
    }
    desc = {
    	trigger = { has_character_modifier = bad_relationship_omen }
    	text = EVTDESC_MNM_1204_B
    }
    
	option = { # I knew something great would happen!
    	name = EVTOPTA_MNM_1204
		tooltip = {
			remove_character_modifier = good_relationship_omen
		}
    	upgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt1 }
	}
	option = { # I am not sure I interpreted the omen correctly...
		name = EVTOPTB_MNM_1204
		tooltip = {
			remove_character_modifier = bad_relationship_omen
		}
		downgrade_seer_modifier_effect = yes

		trigger = { has_character_flag = omen_opt2 }
	}

	after = {
		clr_character_flag = omen_opt1
		clr_character_flag = omen_opt2
	}
}

character_event = { # A Child is born - you're not impressed (fired from on_birth)
    id = MNM.1205
    picture = GFX_evt_secluded_in_prayer
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_dlc = "Mystics"
    	is_alive = yes

    	FROM = {
    		is_alive = yes
   			has_negative_congenital_trigger = yes
    		NOT = { is_smart_trigger = yes }
    		NOT = { is_strong_trigger = yes }
    	}
    	
    	OR = {
    		has_character_modifier = good_relationship_omen
    		has_character_modifier = bad_relationship_omen
    	}
    }

    immediate = {
    	if = { limit = { has_character_modifier = bad_relationship_omen } set_character_flag = omen_opt1 }
    	if = { limit = { has_character_modifier = good_relationship_omen } set_character_flag = omen_opt2 }
    	remove_scrying_omen_modifiers_effect = yes
    }

	desc = {
    	trigger = { has_character_modifier = bad_relationship_omen }
    	text = EVTDESC_MNM_1205_A
    }
    desc = {
    	trigger = { has_character_modifier = good_relationship_omen }
    	text = EVTDESC_MNM_1205_B
    }


	option = { # I knew something bad would happen!
		name = EVTOPTA_MNM_1205
		tooltip = {
			remove_character_modifier = bad_relationship_omen
		}
		upgrade_seer_modifier_effect = yes

		trigger = { has_character_flag = omen_opt1 }
	}
	option = { # I am not sure I interpreted the omen correctly...
    	name = EVTOPTB_MNM_1205
    	tooltip = {
			remove_character_modifier = good_relationship_omen
		}
		downgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt2 }
	}

	after = {
		clr_character_flag = omen_opt1
		clr_character_flag = omen_opt2
	}
}

character_event = { #newborn sends event to parents
    id = MNM.1206
    is_triggered_only = yes
    hide_window = yes

    weight_multiplier = {
		days = 1
		modifier = {
			factor = 5
			OR = {
				has_character_modifier = bad_relationship_omen
				has_character_modifier = good_relationship_omen
			}
		}
	}

    immediate = {
    	father = {
    		character_event = { id = MNM.1204 days = 15 }
			character_event = { id = MNM.1205 days = 15 }
    	}
    	mother = {
    		character_event = { id = MNM.1204 days = 15 }
    		character_event = { id = MNM.1205 days = 15 }
    	}
    }
}

character_event = { # PING/Set-up event: Someone dies - is this what you foretold? (fired from on_death)
    id = MNM.1207
    hide_window = yes
	is_triggered_only = yes

	trigger = {
		OR = {
			any_lover = {
				is_alive = yes
				has_relationship_omen_modifier_trigger = yes
			}
			any_friend = { 
				is_alive = yes
				has_relationship_omen_modifier_trigger = yes
			}

			AND = {
				is_adult = yes
				any_rival = {
					is_alive = yes
					has_relationship_omen_modifier_trigger = yes
				}
			}
			any_child = {
				is_alive = yes
				is_adult = yes
				has_relationship_omen_modifier_trigger = yes
			}
			mother = {
				is_alive = yes
				has_relationship_omen_modifier_trigger = yes
			}
			father = {
				is_alive = yes
				has_relationship_omen_modifier_trigger = yes
			}
		}
		NOR = {
			death_no_trace_trigger = yes
			death_in_china_trigger = yes
		}
	}

	option = {
		save_event_target_as = mnm_scrying_dead

		spouse = { save_event_target_as = mnm_scrying_widow }

		#Lover gets event
		random_lover = {
			limit = {
				NOT = { trait = incapable }
				has_relationship_omen_modifier_trigger = yes
			}
			character_event = { id = MNM.1208 days = 20 } 
		}

		#Friend gets event
		random_friend = {
			limit = {
				NOT = { trait = incapable }
				has_relationship_omen_modifier_trigger = yes
			}
			save_event_target_as = mnm_scrying_friend
			character_event = { id = MNM.1209 days = 30 } 
		}

		#Rival gets event
		random_rival = {
			limit = {
				NOT = { trait = incapable }
				has_relationship_omen_modifier_trigger = yes
			}
			save_event_target_as = mnm_scrying_enemy
			character_event = { id = MNM.1210 days = 30 } 
		}

		# Adult child gets event
		random_child = {
			limit = {
				is_adult = yes
				NOT = { trait = incapable }
				has_relationship_omen_modifier_trigger = yes
			}
			save_event_target_as = mnm_scrying_child
			character_event = { id = MNM.1211 days = 30 } 
		}
		# Parent
		if = {
			limit = {
				mother = {
					NOT = { trait = incapable }
					has_relationship_omen_modifier_trigger = yes
				}
			}
			mother = {
				save_event_target_as = mnm_scrying_parent
				character_event = { id = MNM.1212 days = 30 }
			}
		}
		
		if = {
			limit = {
				father = {
					NOT = { trait = incapable }
					has_relationship_omen_modifier_trigger = yes
				}
			}
			father = {
				save_event_target_as = mnm_scrying_parent
				character_event = { id = MNM.1212 days = 30 }
			}
		}
	}	
}

character_event = { # scrying vision result: the passing of a lover
    id = MNM.1208
    picture = GFX_evt_secluded_in_prayer
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_relationship_omen_modifier_trigger = yes
    	NOT = { trait = incapable }
    }

    desc = {
    	trigger = { has_character_modifier = bad_relationship_omen }
    	text = EVTDESC_MNM_1208_A
    }
    desc = {
    	trigger = { has_character_modifier = good_relationship_omen }
    	text = EVTDESC_MNM_1208_B
    }

    option = {      
        name = EVTOPTA_MNM_1208
        upgrade_seer_modifier_effect = yes

    	trigger = { has_character_modifier = bad_relationship_omen }
    }
    option = {      
        name = EVTOPTB_MNM_1208
        downgrade_seer_modifier_effect = yes

    	trigger = { has_character_modifier = good_relationship_omen }
    }

    after = {
		remove_scrying_omen_modifiers_effect = yes
    }
}

character_event = { # scrying vision result: the passing of a friend
    id = MNM.1209
    picture = GFX_evt_secluded_in_prayer
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_relationship_omen_modifier_trigger = yes
		NOT = { trait = incapable }
    }

    desc = {
    	trigger = { has_character_modifier = bad_relationship_omen }
    	text = EVTDESC_MNM_1209_A
    }
    desc = {
    	trigger = { has_character_modifier = good_relationship_omen }
    	text = EVTDESC_MNM_1209_B
    }

    option = {      
        name = EVTOPTA_MNM_1209
		upgrade_seer_modifier_effect = yes

    	trigger = { has_character_modifier = bad_relationship_omen }
    }
    option = {      
        name = EVTOPTB_MNM_1209
        downgrade_seer_modifier_effect = yes

    	trigger = { has_character_modifier = good_relationship_omen }
    }

    after = {
		remove_scrying_omen_modifiers_effect = yes
    }
}

character_event = { # scrying vision result: the passing of a rival
    id = MNM.1210
    picture = GFX_evt_state_diplomacy
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_relationship_omen_modifier_trigger = yes
		NOT = { trait = incapable }
    }

    desc = {
    	trigger = { has_character_modifier = bad_relationship_omen }
    	text = EVTDESC_MNM_1210_A
    }
    desc = {
    	trigger = { has_character_modifier = good_relationship_omen }
    	text = EVTDESC_MNM_1210_B
    }

    option = {      
        name = EVTOPTA_MNM_1210
        upgrade_seer_modifier_effect = yes

    	trigger = { has_character_modifier = good_relationship_omen }
    }
    option = {      
        name = EVTOPTB_MNM_1210
        downgrade_seer_modifier_effect = yes

    	trigger = { has_character_modifier = bad_relationship_omen }
    }

    after = {
		remove_scrying_omen_modifiers_effect = yes
    }
}

character_event = { # scrying vision result: the passing of a parent
    id = MNM.1211
    picture = GFX_evt_secluded_in_prayer
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_relationship_omen_modifier_trigger = yes
		NOT = { trait = incapable }
    }

    desc = {
    	trigger = { has_character_modifier = bad_relationship_omen }
    	text = EVTDESC_MNM_1211_A
    }
    desc = {
    	trigger = { has_character_modifier = good_relationship_omen }
    	text = EVTDESC_MNM_1211_B
    }

    option = {      
        name = EVTOPTA_MNM_1211
        upgrade_seer_modifier_effect = yes

    	trigger = { has_character_modifier = bad_relationship_omen }
    }
    option = {      
        name = EVTOPTB_MNM_1211
        downgrade_seer_modifier_effect = yes

    	trigger = { has_character_modifier = good_relationship_omen }
    }

    after = {
		remove_scrying_omen_modifiers_effect = yes
    }
}

character_event = { # scrying vision result: the passing of a child
    id = MNM.1212
    picture = GFX_evt_secluded_in_prayer
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_relationship_omen_modifier_trigger = yes
		NOT = { trait = incapable }
    }

    desc = {
    	trigger = { has_character_modifier = bad_relationship_omen }
    	text = EVTDESC_MNM_1212_A
    }
    desc = {
    	trigger = { has_character_modifier = good_relationship_omen }
    	text = EVTDESC_MNM_1212_B
    }

    option = {      
        name = EVTOPTA_MNM_1212
        upgrade_seer_modifier_effect = yes

    	trigger = { has_character_modifier = bad_relationship_omen }
    }
    option = {      
        name = EVTOPTB_MNM_1212
		downgrade_seer_modifier_effect = yes

    	trigger = { has_character_modifier = good_relationship_omen }
    }

    after = {
		remove_scrying_omen_modifiers_effect = yes
    }
}

character_event = { # Ping event for pets
    id = MNM.1213
    is_triggered_only = yes
    hide_window = yes
    
    trigger = {
    	OR = {
			has_character_flag = cat_death_omen
			has_character_flag = dog_death_omen
		}
    }

    immediate = {
    	if = {
    		limit = {
    			has_relationship_omen_modifier_trigger = yes
				NOT = { trait = incapable }
    		}
    		character_event = { id = MNM.1214 }
    	}
    	if = {
    		limit = { trait = incapable }
    		clr_character_flag = cat_death_omen
    		clr_character_flag = dog_death_omen
    	}
    }
}

character_event = { # scrying vision result: Cat/Dog death
    id = MNM.1214
    picture = GFX_evt_secluded_in_prayer
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_relationship_omen_modifier_trigger = yes
		OR = {
			has_character_flag = cat_death_omen
			has_character_flag = dog_death_omen
		}
		NOT = { trait = incapable }
    }

    desc = {
    	trigger = { has_character_modifier = bad_relationship_omen NOT = { trait = lunatic } }
    	text = EVTDESC_MNM_1214_A
    }
    desc = {
    	trigger = { has_character_modifier = good_relationship_omen NOT = { trait = lunatic } }
    	text = EVTDESC_MNM_1214_B
    }
    desc = {
    	trigger = { has_character_modifier = bad_relationship_omen trait = lunatic }
    	text = EVTDESC_MNM_1214_A_lunatic
    }
    desc = {
    	trigger = { has_character_modifier = good_relationship_omen trait = lunatic }
    	text = EVTDESC_MNM_1214_B_lunatic
    }

    option = {      
        name = {
        	text = EVTOPTA_MNM_1214_cat
        	trigger = { has_character_flag = cat_death_omen }
        }
        name = {
        	text = EVTOPTA_MNM_1214_dog
        	trigger = { has_character_flag = dog_death_omen }
        }

    	upgrade_seer_modifier_effect = yes

    	trigger = { has_character_modifier = bad_relationship_omen }
    }
    option = {      
        name = {
        	text = EVTOPTB_MNM_1214_cat
        	trigger = { has_character_flag = cat_death_omen }
        }
        name = {
        	text = EVTOPTB_MNM_1214_dog
        	trigger = { has_character_flag = dog_death_omen }
        }

        downgrade_seer_modifier_effect = yes

    	trigger = { has_character_modifier = good_relationship_omen }
    }

    after = {
    	clr_character_flag = cat_death_omen
    	clr_character_flag = dog_death_omen
		remove_scrying_omen_modifiers_effect = yes
    }
}

character_event = { # Scrying vision result: gaining a new title
    id = MNM.1215
    picture = GFX_evt_gathering_of_minds
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_power_omen_modifier_trigger = yes
		NOT = { trait = incapable }
    }

    immediate = {
    	if = { limit = { has_character_modifier = good_power_omen } set_character_flag = omen_opt1 }
    	if = { limit = { has_character_modifier = bad_power_omen } set_character_flag = omen_opt2 }
    	remove_scrying_omen_modifiers_effect = yes
    }

	desc = {
    	trigger = { has_character_flag = omen_opt1 }
    	text = EVTDESC_MNM_1215_A
    }
    desc = {
    	trigger = { has_character_flag = omen_opt2 }
    	text = EVTDESC_MNM_1215_B
    }

    option = {      
        name = EVTOPTA_MNM_1215
		tooltip = {
			remove_character_modifier = good_power_omen
		}
        upgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt1 }
    }
    option = {      
        name = EVTOPTB_MNM_1215
		tooltip = {
			remove_character_modifier = bad_power_omen
		}
		downgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt2 }
    }

    after = {
		clr_character_flag = omen_opt1
		clr_character_flag = omen_opt2
    }
}

### To handle loss of titles:
character_event = { # 1. new holder of title (ROOT) sends event to old holder (FROMFROM), if they are still alive (sent from on_new_holder, on_new_holder_inheritance and on_new_holder_usurpation)
    id = MNM.1216
    is_triggered_only = yes
    hide_window = yes

    trigger = {
    	FROMFROM = { is_alive = yes }
    }

    immediate = {
    	save_event_target_as = new_holder_target
    	FROMFROM = { save_event_target_as = old_holder_target }
    	character_event = { id = MNM.1218 days = 1 }
    }
}

diploresponse_event = { # 1.B: new holder of title gets exception flag, if the title was granted voluntarily (sent from GRANT_LANDED_TITLE_INTERACTION_ACCEPT_EVENT)
    id = MNM.1217
    is_triggered_only = yes
    hide_window = yes

    immediate = {
		FROM = { set_character_flag = was_granted_title_voluntarily }
    }
}

character_event = { # 2: gating event, to send event or clearing flag for the new holder
    id = MNM.1218
    is_triggered_only = yes
    hide_window = yes

    immediate = {
    	if = {
    		limit = { NOT = { has_character_flag = was_granted_title_voluntarily } }
    		event_target:old_holder_target = { character_event = { id = MNM.1219 days = 3 } }
    	}
    	if = {
    		limit = { has_character_flag = was_granted_title_voluntarily }
			clr_character_flag = was_granted_title_voluntarily
    	}
    }
}

character_event = { # 3: Scrying vision result: losing a title (not sent if given away freely via targeted decision)
    id = MNM.1219
    picture = GFX_evt_gathering_of_minds
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	event_target:new_holder_target = { NOT = { has_character_flag = was_granted_title_voluntarily } }
    	has_power_omen_modifier_trigger = yes
		NOT = { trait = incapable }
    }

    immediate = {
    	if = { limit = { has_character_modifier = bad_power_omen } set_character_flag = omen_opt1 }
    	if = { limit = { has_character_modifier = good_power_omen } set_character_flag = omen_opt2 }
    	remove_scrying_omen_modifiers_effect = yes
    }

	desc = {
    	trigger = { has_character_flag = omen_opt1 }
    	text = EVTDESC_MNM_1219_A
    }
    desc = {
    	trigger = { has_character_flag = omen_opt2 }
    	text = EVTDESC_MNM_1219_B
    }

    option = {      
        name = EVTOPTA_MNM_1219
		tooltip = {
			remove_character_modifier = bad_power_omen
		}
        upgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt1 }
    }
    option = {      
        name = EVTOPTB_MNM_1219
		tooltip = {
			remove_character_modifier = good_power_omen
		}
		downgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt2 }
    }

    after = {
		clr_character_flag = omen_opt1
		clr_character_flag = omen_opt2
    }
}

character_event = { # Scrying vision result: you are sick
    id = MNM.1220
    picture = GFX_evt_recovery
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_power_omen_modifier_trigger = yes
    }

    immediate = {
    	if = { limit = { has_character_modifier = bad_power_omen } set_character_flag = omen_opt1 }
    	if = { limit = { has_character_modifier = good_power_omen } set_character_flag = omen_opt2 }
    	remove_scrying_omen_modifiers_effect = yes
    }

	desc = {
    	trigger = { has_character_flag = omen_opt1 }
    	text = EVTDESC_MNM_1220_A
    }
    desc = {
    	trigger = { has_character_flag = omen_opt2 }
    	text = EVTDESC_MNM_1220_B
    }

    option = {      
        name = EVTOPTA_MNM_1220
		tooltip = {
			remove_character_modifier = bad_power_omen
		}
        upgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt1 }
    }
    option = {      
        name = EVTOPTB_MNM_1220
		tooltip = {
			remove_character_modifier = good_power_omen
		}
		downgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt2 }
    }

    after = {
		clr_character_flag = omen_opt1
		clr_character_flag = omen_opt2
    }
}
character_event = { # Scrying vision result: FROM is sick
    id = MNM.1221
    picture = GFX_evt_recovery
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	FROM = { is_alive = yes }
    	OR = {
			has_character_modifier = good_relationship_omen
			has_character_modifier = bad_relationship_omen
		}
    }

    immediate = {
    	if = { limit = { has_character_modifier = bad_relationship_omen } set_character_flag = omen_opt1 }
    	if = { limit = { has_character_modifier = good_relationship_omen } set_character_flag = omen_opt2 }
    	remove_scrying_omen_modifiers_effect = yes
    }

	desc = {
    	trigger = { FROM = { NOT = { character = ROOT } } has_character_flag = omen_opt1 }
    	text = EVTDESC_MNM_1221_A
    }
    desc = {
    	trigger = { FROM = { NOT = { character = ROOT } } has_character_flag = omen_opt2 }
    	text = EVTDESC_MNM_1221_B
    }
	desc = {
    	trigger = { FROM = { character = ROOT } has_character_flag = omen_opt1 }
    	text = EVTDESC_MNM_1221_C
    }
    desc = {
    	trigger = { FROM = { character = ROOT } has_character_flag = omen_opt2 }
    	text = EVTDESC_MNM_1221_D
    }

    option = {      
        name = EVTOPTA_MNM_1221
		tooltip = {
			remove_character_modifier = bad_relationship_omen
		}
        upgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt1 }
    }
    option = {      
        name = EVTOPTB_MNM_1221
		tooltip = {
			remove_character_modifier = good_relationship_omen
		}
		downgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt2 }
    }

    after = {
		clr_character_flag = omen_opt1
		clr_character_flag = omen_opt2
    }
}

character_event = { # Scrying vision result: you are healthy!
    id = MNM.1222
    picture = GFX_evt_recovery
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_power_omen_modifier_trigger = yes
    }

    immediate = {
    	if = { limit = { has_character_modifier = good_power_omen } set_character_flag = omen_opt1 }
    	if = { limit = { has_character_modifier = bad_power_omen } set_character_flag = omen_opt2 }
    	remove_scrying_omen_modifiers_effect = yes
    }

	desc = {
    	trigger = { has_character_flag = omen_opt1 }
    	text = EVTDESC_MNM_1222_A
    }
    desc = {
    	trigger = { has_character_flag = omen_opt2 }
    	text = EVTDESC_MNM_1222_B
    }

    option = {      
        name = EVTOPTA_MNM_1222
		tooltip = {
			remove_character_modifier = good_power_omen
		}
        upgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt1 }
    }
    option = {      
        name = EVTOPTB_MNM_1222
		tooltip = {
			remove_character_modifier = bad_power_omen
		}
		downgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt2 }
    }

    after = {
		clr_character_flag = omen_opt1
		clr_character_flag = omen_opt2
    }
}

character_event = { # Scrying vision result: FROM is healthy!
    id = MNM.1223
    picture = GFX_evt_recovery
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	FROM = { is_alive = yes }
    	OR = {
			has_character_modifier = good_relationship_omen
			has_character_modifier = bad_relationship_omen
		}
    }

    immediate = {
    	if = { limit = { has_character_modifier = good_relationship_omen } set_character_flag = omen_opt1 }
    	if = { limit = { has_character_modifier = bad_relationship_omen } set_character_flag = omen_opt2 }
    	remove_scrying_omen_modifiers_effect = yes
    }

	desc = {
    	trigger = { has_character_flag = omen_opt1 }
    	text = EVTDESC_MNM_1223_A
    }
    desc = {
    	trigger = { has_character_flag = omen_opt2 }
    	text = EVTDESC_MNM_1223_B
    }

    option = {      
        name = EVTOPTA_MNM_1223
		tooltip = {
			remove_character_modifier = good_relationship_omen
		}
        upgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt1 }
    }
    option = {      
        name = EVTOPTB_MNM_1223
		tooltip = {
			remove_character_modifier = bad_relationship_omen
		}
		downgrade_seer_modifier_effect = yes

    	trigger = { has_character_flag = omen_opt2 }
    }

    after = {
		clr_character_flag = omen_opt1
		clr_character_flag = omen_opt2
    }
}

character_event = { # FALLBACK (delayed event): Something good happens
    id = MNM.1225
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes
    picture = GFX_evt_state_diplomacy
    trigger = {
    	has_an_omen_modifier_trigger = yes
    }

    immediate = {
        if = {
        	limit = {
       			has_character_modifier = good_battle_omen
        	}
        	set_character_flag = omen_opt_good_battle
        }
    	if = {
    		limit = {
       			has_character_modifier = bad_battle_omen
    		}
    		set_character_flag = omen_opt_bad_battle
    	}
    	if = {
        	limit = {
       			has_character_modifier = good_relationship_omen
        	}
        	hidden_effect = {
		        #... Find a friend
				if = {
					limit = { any_courtier = { NOR = { is_friend = ROOT is_rival = ROOT is_lover = ROOT } is_adult = yes } }

					random_courtier = {
						limit = { NOR = { is_friend = ROOT is_rival = ROOT is_lover = ROOT } is_adult = yes } 
						save_event_target_as = envisioned_friend
					}
				}
				#... Or create a new one
				if = {
					limit = { NOT = { any_courtier = { NOR = { is_friend = ROOT is_rival = ROOT is_lover = ROOT } is_adult = yes } } }

					create_character = {
						random_traits = yes
						dynasty = random
					}
					new_character = {
						save_event_target_as = envisioned_friend
					}
				}
			}
        	set_character_flag = omen_opt_good_relationship
        }
    	if = {
    		limit = {
       			has_character_modifier = bad_relationship_omen
    		}
    		hidden_effect = {
		        #... Find a friend
				if = {
					limit = { any_courtier = { NOR = { is_friend = ROOT is_rival = ROOT is_lover = ROOT } is_adult = yes } }

					random_courtier = {
						limit = { NOR = { is_friend = ROOT is_rival = ROOT is_lover = ROOT } is_adult = yes } 
						save_event_target_as = envisioned_friend
					}
				}
				#... Or create a new one
				if = {
					limit = { NOT = { any_courtier = { NOR = { is_friend = ROOT is_rival = ROOT is_lover = ROOT } is_adult = yes } } }

					create_character = {
						random_traits = yes
						dynasty = random
					}
					new_character = {
						save_event_target_as = envisioned_friend
					}
				}
			}
    		set_character_flag = omen_opt_bad_relationship
    	}
    	if = {
        	limit = {
       			has_character_modifier = good_power_omen
        	}
        	set_character_flag = omen_opt_good_power
        }
    	if = {
    		limit = {
       			has_character_modifier = bad_power_omen       
    		}
    		set_character_flag = omen_opt_bad_power
    	}
    	remove_scrying_omen_modifiers_effect = yes
    }

	desc = {
    	trigger = { has_character_flag = omen_opt_good_battle }
    	picture = GFX_evt_hunt
    	text = EVTDESC_MNM_1225_A
    }
    desc = {
    	trigger = { has_character_flag = omen_opt_bad_battle }
    	picture = GFX_evt_hunt
    	text = EVTDESC_MNM_1225_B
    }
    desc = {
    	trigger = { has_character_flag = omen_opt_good_relationship }
    	picture = GFX_evt_state_diplomacy
    	text = EVTDESC_MNM_1225_C
    }
    desc = {
    	trigger = { has_character_flag = omen_opt_bad_relationship }
    	picture = GFX_evt_state_diplomacy
    	text = EVTDESC_MNM_1225_D
    }
    desc = {
    	trigger = { has_character_flag = omen_opt_good_power }
		picture = GFX_evt_prospering_province
    	text = EVTDESC_MNM_1225_E
    }
    desc = {
    	trigger = { has_character_flag = omen_opt_bad_power }
    	picture = GFX_evt_prospering_province
    	text = EVTDESC_MNM_1225_F
    }

 	option = {
        name = {
        	text = EVTOPTA_MNM_1225_battle
        	trigger = { has_character_flag = omen_opt_good_battle }
        }
        name = {
        	text = EVTOPTA_MNM_1225_relationship
        	trigger = { has_character_flag = omen_opt_good_relationship }
        }
        name = {
        	text = EVTOPTA_MNM_1225_power
        	trigger = { has_character_flag = omen_opt_good_power }
        }
        if = { limit = { has_character_flag = omen_opt_good_battle }
			tooltip = {
				remove_character_modifier = good_battle_omen
			}
			capital_scope = {
				add_province_modifier = {
					name = proud_hunters_spirit
					duration = 2920
				}
			}
        }
        if = { limit = { has_character_flag = omen_opt_good_relationship }
			tooltip = {
				remove_character_modifier = good_relationship_omen
			}
        	add_friend = event_target:envisioned_friend
        }
        if = { limit = { has_character_flag = omen_opt_good_power }
			tooltip = {
				remove_character_modifier = good_power_omen
			}
			add_pet_owl_effect = yes
        }
        upgrade_seer_modifier_effect = yes

    	trigger = {
    		OR = {
    			has_character_flag = omen_opt_good_battle
    			has_character_flag = omen_opt_good_relationship
    			has_character_flag = omen_opt_good_power
    		}
    	}
    }
    option = {
        name = {
        	text = EVTOPTB_MNM_1225_battle
        	trigger = { has_character_flag = omen_opt_bad_battle }
        }
        name = {
        	text = EVTOPTB_MNM_1225_relationship
        	trigger = { has_character_flag = omen_opt_bad_relationship }
        }
        name = {
        	text = EVTOPTB_MNM_1225_power
        	trigger = { has_character_flag = omen_opt_bad_power }
        }
		if = { limit = { has_character_flag = omen_opt_bad_battle }
			tooltip = {
				remove_character_modifier = bad_battle_omen
			}
			capital_scope = {
				add_province_modifier = {
					name = proud_hunters_spirit
					duration = 2920
				}
			}
        }
        if = { limit = { has_character_flag = omen_opt_bad_relationship }
			tooltip = {
				remove_character_modifier = bad_relationship_omen
			}
			add_friend = event_target:envisioned_friend
        }
        if = { limit = { has_character_flag = omen_opt_bad_power }
			tooltip = {
				remove_character_modifier = bad_power_omen
			}
			add_pet_owl_effect = yes
        }
		downgrade_seer_modifier_effect = yes

    	trigger = {
    		OR = {
    			has_character_flag = omen_opt_bad_battle
    			has_character_flag = omen_opt_bad_relationship
    			has_character_flag = omen_opt_bad_power
    		}
    	}
    }

    after = {
		clr_character_flag = omen_opt_good_battle
		clr_character_flag = omen_opt_bad_battle
		clr_character_flag = omen_opt_good_relationship
		clr_character_flag = omen_opt_bad_relationship
		clr_character_flag = omen_opt_good_power
		clr_character_flag = omen_opt_bad_power
    }
}


character_event = { # FALLBACK (delayed event): Something bad happens
    id = MNM.1226
    border = GFX_event_normal_frame_religion
	picture = GFX_evt_gathering_of_minds
    is_triggered_only = yes
    trigger = {
    	has_an_omen_modifier_trigger = yes
    }

    immediate = {
        if = {
        	limit = {
       			has_character_modifier = good_battle_omen
        	}
        	set_character_flag = omen_opt_good_battle
        }
    	if = {
    		limit = {
       			has_character_modifier = bad_battle_omen
    		}
    		set_character_flag = omen_opt_bad_battle
    	}
    	if = {
        	limit = {
       			has_character_modifier = good_relationship_omen
        	}
        	hidden_effect = {
				#... Find a rival
				if = {
					limit = { any_courtier = { NOR = { is_friend = ROOT is_rival = ROOT is_lover = ROOT } is_adult = yes } }

					random_courtier = {
						limit = { NOR = { is_friend = ROOT is_rival = ROOT is_lover = ROOT } is_adult = yes } 
						save_event_target_as = envisioned_rival
					}
				}

				#... Or create a new one
				if = {
					limit = { NOT = { any_courtier = { NOR = { is_friend = ROOT is_rival = ROOT is_lover = ROOT } is_adult = yes } } }

					create_character = {
						random_traits = yes
						dynasty = random
					}
					new_character = {
						save_event_target_as = envisioned_rival
					}
				}
			}
        	set_character_flag = omen_opt_good_relationship
        }
    	if = {
    		limit = {
       			has_character_modifier = bad_relationship_omen
    		}
    		hidden_effect = {
				#... Find a rival
				if = {
					limit = { any_courtier = { NOR = { is_friend = ROOT is_rival = ROOT is_lover = ROOT } is_adult = yes } }

					random_courtier = {
						limit = { NOR = { is_friend = ROOT is_rival = ROOT is_lover = ROOT } is_adult = yes } 
						save_event_target_as = envisioned_rival
					}
				}

				#... Or create a new one
				if = {
					limit = { NOT = { any_courtier = { NOR = { is_friend = ROOT is_rival = ROOT is_lover = ROOT } is_adult = yes } } }

					create_character = {
						random_traits = yes
						dynasty = random
					}
					new_character = {
						save_event_target_as = envisioned_rival
					}
				}
			}
    		set_character_flag = omen_opt_bad_relationship
    	}
    	if = {
        	limit = {
       			has_character_modifier = good_power_omen
        	}
        	set_character_flag = omen_opt_good_power
        }
    	if = {
    		limit = {
       			has_character_modifier = bad_power_omen       
    		}
    		set_character_flag = omen_opt_bad_power
    	}
    	remove_scrying_omen_modifiers_effect = yes
    }

	desc = {
    	trigger = { has_character_flag = omen_opt_bad_battle }
    	picture = GFX_evt_hunt
    	text = EVTDESC_MNM_1226_A
    }
    desc = {
    	trigger = { has_character_flag = omen_opt_good_battle }
    	picture = GFX_evt_hunt
    	text = EVTDESC_MNM_1226_B
    }
    desc = {
    	trigger = { has_character_flag = omen_opt_bad_relationship }
    	picture = GFX_evt_gathering_of_minds
    	text = EVTDESC_MNM_1226_C
    }
    desc = {
    	trigger = { has_character_flag = omen_opt_good_relationship }
    	picture = GFX_evt_gathering_of_minds
    	text = EVTDESC_MNM_1226_D
    }
    desc = {
    	trigger = { has_character_flag = omen_opt_bad_power }
   		picture = GFX_evt_prospering_province
    	text = EVTDESC_MNM_1226_E
    }
    desc = {
    	trigger = { has_character_flag = omen_opt_good_power }
   		picture = GFX_evt_prospering_province
    	text = EVTDESC_MNM_1226_F
    }

    option = {
		name = {
        	text = EVTOPTA_MNM_1226_battle
        	trigger = { has_character_flag = omen_opt_bad_battle }
        }
        name = {
        	text = EVTOPTA_MNM_1226_relationship
        	trigger = { has_character_flag = omen_opt_bad_relationship }
        }
        name = {
        	text = EVTOPTA_MNM_1226_power
        	trigger = { has_character_flag = omen_opt_bad_power }
        }

		if = { limit = { has_character_flag = omen_opt_bad_battle }
			tooltip = {
				remove_character_modifier = bad_battle_omen
			}
			add_maimed_trait_effect = yes
        }
        if = { limit = { has_character_flag = omen_opt_bad_relationship }
			tooltip = {
				remove_character_modifier = bad_relationship_omen
			}
			add_rival = event_target:envisioned_rival
        }
        if = { limit = { has_character_flag = omen_opt_bad_power }
			tooltip = {
				remove_character_modifier = bad_power_omen
			}
        }
		upgrade_seer_modifier_effect = yes

    	trigger = {
    		OR = {
    			has_character_flag = omen_opt_bad_battle
    			has_character_flag = omen_opt_bad_relationship
    			has_character_flag = omen_opt_bad_power
    		}
    	}
    }
 	option = {      
		name = {
        	text = EVTOPTB_MNM_1226_battle
        	trigger = { has_character_flag = omen_opt_good_battle }
        }
        name = {
        	text = EVTOPTB_MNM_1226_relationship
        	trigger = { has_character_flag = omen_opt_good_relationship }
        }
        name = {
        	text = EVTOPTB_MNM_1226_power
        	trigger = { has_character_flag = omen_opt_good_power }
        }

        if = { limit = { has_character_flag = omen_opt_good_battle }
			tooltip = {
				remove_character_modifier = good_battle_omen
			}
			add_maimed_trait_effect = yes
        }
        if = { limit = { has_character_flag = omen_opt_good_relationship }
			tooltip = {
				remove_character_modifier = good_relationship_omen
			}
			add_rival = event_target:envisioned_rival
        }
        if = { limit = { has_character_flag = omen_opt_good_power }
			tooltip = {
				remove_character_modifier = good_power_omen
			}
        }
        downgrade_seer_modifier_effect = yes

    	trigger = {
    		OR = {
    			has_character_flag = omen_opt_good_battle
    			has_character_flag = omen_opt_good_relationship
    			has_character_flag = omen_opt_good_power
    		}
    	}
    }

    after = {
		clr_character_flag = omen_opt_good_battle
		clr_character_flag = omen_opt_bad_battle
		clr_character_flag = omen_opt_good_relationship
		clr_character_flag = omen_opt_bad_relationship
		clr_character_flag = omen_opt_good_power
		clr_character_flag = omen_opt_bad_power
    }
}

character_event = { # Scrying result fallback: Nothing happened, after all this time
    id = MNM.1227
    desc = EVTDESC_MNM_1227
    picture = GFX_evt_secluded_in_prayer
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes
    trigger = {
		has_an_omen_modifier_trigger = yes
    }

    immediate = {
 		if = {
        	limit = {
       			has_character_modifier = good_battle_omen
        	}
        	set_character_flag = omen_opt_good_battle
        }
    	if = {
    		limit = {
       			has_character_modifier = bad_battle_omen
    		}
    		set_character_flag = omen_opt_bad_battle
    	}
    	if = {
        	limit = {
       			has_character_modifier = good_relationship_omen
        	}
        	set_character_flag = omen_opt_good_relationship
        }
    	if = {
    		limit = {
       			has_character_modifier = bad_relationship_omen
    		}
    		set_character_flag = omen_opt_bad_relationship
    	}
    	if = {
        	limit = {
       			has_character_modifier = good_power_omen
        	}
        	set_character_flag = omen_opt_good_power
        }
    	if = {
    		limit = {
       			has_character_modifier = bad_power_omen       
    		}
    		set_character_flag = omen_opt_bad_power
    	}
    	remove_scrying_omen_modifiers_effect = yes
    }

    option = {
        name = EVTOPTA_MNM_1227
        custom_tooltip = { text = EVTOPTA_MNM_1227_TT }

		if = { limit = { has_character_flag = omen_opt_good_battle }
			tooltip = {
				remove_character_modifier = good_battle_omen
			}
        }
        if = { limit = { has_character_flag = omen_opt_good_relationship }
			tooltip = {
				remove_character_modifier = good_relationship_omen
			}
        }
        if = { limit = { has_character_flag = omen_opt_good_power }
			tooltip = {
				remove_character_modifier = good_power_omen
			}
        }
        if = { limit = { has_character_flag = omen_opt_bad_battle }
			tooltip = {
				remove_character_modifier = bad_battle_omen
			}
        }
        if = { limit = { has_character_flag = omen_opt_bad_relationship }
			tooltip = {
				remove_character_modifier = bad_relationship_omen
			}
        }
        if = { limit = { has_character_flag = omen_opt_bad_power }
			tooltip = {
				remove_character_modifier = bad_power_omen
			}
        }
	
		clr_character_flag = omen_opt_good_battle
		clr_character_flag = omen_opt_bad_battle
		clr_character_flag = omen_opt_good_relationship
		clr_character_flag = omen_opt_bad_relationship
		clr_character_flag = omen_opt_good_power
		clr_character_flag = omen_opt_bad_power
    }
}
######################## /end of Scrying events ########################

### POWER: Make Horoscope ####
character_event = { # You prepare the horoscope (for horoscope_maker)
    id = MNM.1250
    desc = EVTDESC_MNM_1250
    picture = GFX_evt_secluded_in_prayer
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_dlc = "Mystics"
    }

    immediate = {
    	save_event_target_as = horoscope_maker
    	event_target:horoscope_child = {
   			set_character_flag = horoscope_path_1 #they are destined for grandeur
    	}
    }

    option = { # "Come what may"
        name = EVTOPTA_MNM_1250
        custom_tooltip = { text = EVTOPTA_MNM_1250_TT }
    }

    after = {
    	hidden_effect = {
    		event_target:horoscope_child = {
    			set_variable = { which = horoscope_destiny_points value = 0 } # to track truthfulness of horoscope
	    		set_character_flag = horoscope_destiny_revealed # to track and handle horoscope_maker dying
	    		character_event = { id = MNM.1297 days = 5 } # Gating event
	    	}
    	}
    }
}

character_event = { #Child is destined for grandeur (for horoscope_maker)
    id = MNM.1251
    picture = GFX_evt_secluded_in_prayer
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_dlc = "Mystics"
    }

    immediate = {
    	hidden_effect = {
	    	event_target:horoscope_child = {
		    	random_list = {
		    		10 = {
		    			set_character_flag = destined_steward
		    		}
		    		10 = {
		    			set_character_flag = destined_fighter
		    		}
		    		10 = {
		    			set_character_flag = destined_diplomat
		    		}
		    		10 = {
		    			set_character_flag = destined_schemer
		    		}
		    		10 = {
		    			set_character_flag = destined_scholar
		    		}
		    	}
	    	}
	    }
    }

    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_steward } }
    	text = EVTDESC_MNM_1251_steward
    }
    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_fighter } }
    	text = EVTDESC_MNM_1251_fighter
    }
    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_diplomat } }
    	text = EVTDESC_MNM_1251_diplomat
    }
    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_schemer } }
    	text = EVTDESC_MNM_1251_schemer
    }
    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_scholar } }
    	text = EVTDESC_MNM_1251_scholar
    }

    option = { # This is exactly what I want for them
        name = EVTOPTA_MNM_1251
        custom_tooltip = { text = EVTOPTA_MNM_1251_TT }
        event_target:horoscope_child = {
        	set_character_flag = encouraged_horoscope_pattern
        }
        hidden_effect = { event_target:horoscope_child = { change_variable = { which = horoscope_destiny_points value = 5 } } } # increase likelyhood of fulfilling horoscope...      
    }
    option = { # We need to discourage these tendencies
        name = EVTOPTB_MNM_1251
        custom_tooltip = { text = EVTOPTB_MNM_1251_TT }
        event_target:horoscope_child = {
        	set_character_flag = discouraged_horoscope_pattern
        }
        hidden_effect = { event_target:horoscope_child = { change_variable = { which = horoscope_destiny_points value = -5 } } } # decrease likelyhood of fulfilling horoscope...      
    }

    after = {
    	hidden_effect = {
    		event_target:horoscope_child = {
    			if = { limit = { ROOT = { is_female = yes } }
    				set_character_flag = horoscope_maker_is_mother
    			}
    			if = { limit = { ROOT = { is_female = no } }
    				set_character_flag = horoscope_maker_is_father
    			}

    			set_character_flag = horoscope_child_receives_horoscope
    			character_event = { id = MNM.1297 days = 60 } #gating event, then notify child of this
    		}
    	}
    }
}

character_event = { # Child receives horoscope (for horoscope_child)
    id = MNM.1252
    picture = GFX_evt_gathering_of_minds
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_dlc = "Mystics"
    }

    desc = {
    	trigger = {
    		has_character_flag = encouraged_horoscope_pattern
    		NOT = { has_character_flag = horoscope_maker_died }
    	}
    	text = EVTDESC_MNM_1252_A
    }
    desc = {
    	trigger = {
    		has_character_flag = discouraged_horoscope_pattern
    		NOT = { has_character_flag = horoscope_maker_died }
    	}
    	text = EVTDESC_MNM_1252_B
    }
    desc = {
    	trigger = {
    		has_character_flag = encouraged_horoscope_pattern
    		has_character_flag = horoscope_maker_died
    	}
    	text = EVTDESC_MNM_1252_C
    }
    desc = {
    	trigger = {
    		has_character_flag = discouraged_horoscope_pattern
    		has_character_flag = horoscope_maker_died
    	}
    	text = EVTDESC_MNM_1252_D
    }

    option = { # chain continues (if horoscope_maker lives)
        name = {
        	text = EVTOPTA_MNM_1252_1 # I wouldn't mind being great at something
        	trigger = { has_character_flag = encouraged_horoscope_pattern }
        }
        name = {
        	text = EVTOPTA_MNM_1252_2 # I hope I didn't do anything wrong
        	trigger = { has_character_flag = discouraged_horoscope_pattern }
        }
        custom_tooltip = { text = EVTOPTA_MNM_1252_TT } #You try to put it out of your mind
    	
        hidden_effect = { character_event = { id = MNM.1297 days = 10 } } #send gating event before next step...
		set_horoscope_modifier_effect = yes

    	trigger = { NOT = { has_character_flag = horoscope_maker_died } }
    }
    option = { # - END (if horoscope_maker is dead)
        name = {
        	text = EVTOPTB_MNM_1252_1 #I wonder what they saw
        	trigger = { has_character_flag = encouraged_horoscope_pattern }
        }
        name = {
        	text = EVTOPTB_MNM_1252_2 # that certainly takes the pressure off!
        	trigger = { has_character_flag = discouraged_horoscope_pattern }
        }
        custom_tooltip = { text = EVTOPTA_MNM_1252_TT } #You try to put it out of your mind
		hidden_effect = { clean_up_horoscope_effect = yes }
    	trigger = { has_character_flag = horoscope_maker_died }
    }
}

character_event = { # You receive update (for horoscope_maker, kid has to be over 6 years old?)
    id = MNM.1253
    picture = GFX_evt_gathering_of_minds
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
		event_target:horoscope_child = { is_alive = yes }
    	society_member_of = hermetics
    }

    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_steward } }
    	text = EVTDESC_MNM_1253_steward
    }
    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_fighter } }
    	text = EVTDESC_MNM_1253_fighter
    }
    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_diplomat } }
    	text = EVTDESC_MNM_1253_diplomat
    }
    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_schemer } }
    	text = EVTDESC_MNM_1253_schemer
    }
    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_scholar } }
    	text = EVTDESC_MNM_1253_scholar
    }

    option = {
        name = EVTOPTA_MNM_1253 #This is great! Just as the stars predicted...
        custom_tooltip = { text = EVTOPTA_MNM_1253_TT }
        hidden_effect = { event_target:horoscope_child = { change_variable = { which = horoscope_destiny_points value = 3 } } } # increase likelyhood of fulfilling horoscope...

        trigger = { event_target:horoscope_child = { has_character_flag = encouraged_horoscope_pattern } }
    }
    option = {
        name = EVTOPTB_MNM_1253 # This is not so great. This is not a path I want for them...
        custom_tooltip = { text = EVTOPTB_MNM_1253_TT }
        hidden_effect = { event_target:horoscope_child = { change_variable = { which = horoscope_destiny_points value = -7 } } } # decrease likelyhood of fulfilling horoscope...

        trigger = { event_target:horoscope_child = { has_character_flag = encouraged_horoscope_pattern } }
    }
    option = {
        name = EVTOPTC_MNM_1253 #This is not so terrible, I guess. In spite of my doubts...
        custom_tooltip = { text = EVTOPTC_MNM_1253_TT }
        hidden_effect = { event_target:horoscope_child = { change_variable = { which = horoscope_destiny_points value = 3 } } } # increase likelyhood of fulfilling horoscope...

        trigger = { event_target:horoscope_child = { has_character_flag = discouraged_horoscope_pattern } }
    }
    option = {
        name = EVTOPTD_MNM_1253 #This is terrible! Still not at ALL what I want for them...!
        custom_tooltip = { text = EVTOPTD_MNM_1253_TT }
        hidden_effect = { event_target:horoscope_child = { change_variable = { which = horoscope_destiny_points value = -7 } } } # decrease likelyhood of fulfilling horoscope...

        trigger = { event_target:horoscope_child = { has_character_flag = discouraged_horoscope_pattern } }
    }
    after = {
    	hidden_effect = {
    		event_target:horoscope_child = { character_event = { id = MNM.1297 days = 10 } }
    	}
    }
}

character_event = { # Child contemplates their destiny - is this what they want? (for horoscope_child)
    id = MNM.1254
    picture = GFX_evt_ritual_scroll
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
		is_alive = yes
		any_courtier = {
			is_adult = yes
			prisoner = no
		}
    }

    immediate = {
    	random_courtier = {
			limit = { is_adult = yes prisoner = no }
			save_event_target_as = inspiring_adult
		}
    	if = { limit = { has_guardian = yes }
	    	trigger_switch = { # finds an appropriate inspiring adult...
	    		on_trigger = has_character_flag
				destined_steward = {
					random_courtier = {
						limit = { is_adult = yes prisoner = no is_guardian = ROOT }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no stewardship = 15 is_guardian = ROOT }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no stewardship = 15 has_education_stewardship_trigger = yes }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no stewardship = 15 has_education_stewardship_trigger = yes has_top_tier_education_trait_trigger = yes }
						save_event_target_as = inspiring_adult
					}
				}
				destined_fighter = {
					random_courtier = {
						limit = { is_adult = yes prisoner = no is_guardian = ROOT }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no martial = 15 is_guardian = ROOT }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no martial = 15 has_education_martial_trigger = yes }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no martial = 15 has_education_martial_trigger = yes has_top_tier_education_trait_trigger = yes }
						save_event_target_as = inspiring_adult
					}
				}
				destined_diplomat = {
					random_courtier = {
						limit = { is_adult = yes prisoner = no is_guardian = ROOT }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no diplomacy = 15 is_guardian = ROOT }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no diplomacy = 15 has_education_diplomacy_trigger = yes }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no diplomacy = 15 has_education_diplomacy_trigger = yes has_top_tier_education_trait_trigger = yes }
						save_event_target_as = inspiring_adult
					}
				}
				destined_schemer = {
					random_courtier = {
						limit = { is_adult = yes prisoner = no is_guardian = ROOT }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no intrigue = 15 is_guardian = ROOT }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no intrigue = 15 has_education_intrigue_trigger = yes }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no intrigue = 15 has_education_intrigue_trigger = yes has_top_tier_education_trait_trigger = yes }
						save_event_target_as = inspiring_adult
					}
				}
				destined_scholar = {
					random_courtier = {
						limit = { is_adult = yes prisoner = no is_guardian = ROOT }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no learning = 15 is_guardian = ROOT }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no learning = 15 has_education_learning_trigger = yes }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no learning = 15 has_education_learning_trigger = yes has_top_tier_education_trait_trigger = yes }
						save_event_target_as = inspiring_adult
					}
				}
	    	}
    	}
    	if = { limit = { has_guardian = no }
	    	trigger_switch = { # finds an appropriate inspiring adult...
	    		on_trigger = has_character_flag
				destined_steward = {
					random_courtier = {
						limit = { is_adult = yes prisoner = no }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no stewardship = 15 }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no stewardship = 15 has_education_stewardship_trigger = yes }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no stewardship = 15  has_education_stewardship_trigger = yes has_top_tier_education_trait_trigger = yes }
						save_event_target_as = inspiring_adult
					}
				}
				destined_fighter = {
					random_courtier = {
						limit = { is_adult = yes prisoner = no }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no martial = 15 }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no martial = 15 has_education_martial_trigger = yes }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no martial = 15  has_education_martial_trigger = yes has_top_tier_education_trait_trigger = yes }
						save_event_target_as = inspiring_adult
					}
				}
				destined_diplomat = {
					random_courtier = {
						limit = { is_adult = yes prisoner = no }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no diplomacy = 15 }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no diplomacy = 15 has_education_diplomacy_trigger = yes }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no diplomacy = 15  has_education_diplomacy_trigger = yes has_top_tier_education_trait_trigger = yes }
						save_event_target_as = inspiring_adult
					}
				}
				destined_schemer = {
					random_courtier = {
						limit = { is_adult = yes prisoner = no }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no intrigue = 15 }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no intrigue = 15 has_education_intrigue_trigger = yes }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no intrigue = 15  has_education_intrigue_trigger = yes has_top_tier_education_trait_trigger = yes }
						save_event_target_as = inspiring_adult
					}
				}
				destined_scholar = {
					random_courtier = {
						limit = { is_adult = yes prisoner = no }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no learning = 15 }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no learning = 15 has_education_learning_trigger = yes }
						save_event_target_as = inspiring_adult
					}
					random_courtier = {
						limit = { is_adult = yes prisoner = no learning = 15 has_education_learning_trigger = yes has_top_tier_education_trait_trigger = yes }
						save_event_target_as = inspiring_adult
					}
				}
	    	}
    	}
    }

    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_steward } }
    	text = EVTDESC_MNM_1254_steward
    }
    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_fighter } }
    	text = EVTDESC_MNM_1254_fighter
    }
    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_diplomat } }
    	text = EVTDESC_MNM_1254_diplomat
    }
    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_schemer } }
    	text = EVTDESC_MNM_1254_schemer
    }
    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = destined_scholar } }
    	text = EVTDESC_MNM_1254_scholar
    }

    option = {
        name = EVTOPTA_MNM_1254 # I feel like this is what I am MEANT to be doing. Just as [parent's] horoscope predicted...
        hidden_effect = { change_variable = { which = horoscope_destiny_points value = 5 } }
        set_character_flag = embraced_destiny

        event_target:inspiring_adult = {
			opinion = {
				modifier = opinion_delighted
				who = ROOT
				years = 10
			}
		}

        ai_chance = { #If ai is already on the right track...
        	factor = 50
        	modifier = {
        		factor = 1.5
        		OR = {
        			AND = {
        				has_character_flag = destined_steward
        				OR = { trait = conscientious trait = fussy trait = curious }
        			}
        			AND = {
        				has_character_flag = destined_fighter
        				OR = { trait = rowdy trait = haughty }
        			}
        			AND = {
        				has_character_flag = destined_diplomat
        				OR = { trait = playful trait = affectionate }
        			}
        			AND = {
        				has_character_flag = destined_schemer
        				OR = { trait = willful trait = brooding trait = indolent }
        			}
        			AND = {
        				has_character_flag = destined_scholar
        				OR = { trait = idolizer trait = timid }
        			}
        		}
        	}
        	modifier = {
        		factor = 1.5
        		OR = {
        			AND = { stewardship = 5 has_character_flag = destined_steward }
        			AND = { martial = 5 has_character_flag = destined_fighter }
        			AND = { diplomacy = 5 has_character_flag = destined_diplomat }
        			AND = { intrigue = 5 has_character_flag = destined_schemer }
        			AND = { learning = 5 has_character_flag = destined_scholar }
        		}
        	}
        	modifier = {
        		factor = 1.5
        		OR = {
        			AND = { stewardship = 7 has_character_flag = destined_steward }
        			AND = { martial = 7 has_character_flag = destined_fighter }
        			AND = { diplomacy = 7 has_character_flag = destined_diplomat }
        			AND = { intrigue = 7 has_character_flag = destined_schemer }
        			AND = { learning = 7 has_character_flag = destined_scholar }
        		}
        	}
        	modifier = {
        		factor = 1.5
        		OR = {
        			AND = { stewardship = 9 has_character_flag = destined_steward }
        			AND = { martial = 9 has_character_flag = destined_fighter }
        			AND = { diplomacy = 9 has_character_flag = destined_diplomat }
        			AND = { intrigue = 9 has_character_flag = destined_schemer }
        			AND = { learning = 9 has_character_flag = destined_scholar }
        		}
        	}
		}
    }
    option = {
        name = EVTOPTB_MNM_1254  # I don't think this is my path...

		ai_chance = { # AI shouldn't pick this...
        	factor = 30
        }
 		if = {
			limit = {
				NOR = {
					trait = stressed
					trait = depressed
				}
			}
			random = {
				chance = 50
				add_trait = stressed
				hidden_tooltip = {
					character_event = {
						id = 38282 #Notify Stressed
					}
				}
			}
		}

        hidden_effect = { change_variable = { which = horoscope_destiny_points value = -5 } }
        set_character_flag = refused_destiny
    }

    after = {
    	hidden_effect = {
    		character_event = { id = MNM.1297 days = 100 } 
    	}
    }
}

character_event = { # Parent receives update about how the child is taking to their destiny (for horoscope_maker)
    id = MNM.1255
    picture = GFX_evt_gathering_of_minds
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	event_target:horoscope_child = { is_alive = yes }
    	society_member_of = hermetics
    }

    desc = {
    	text = EVTDESC_MNM_1255_A
    	trigger = { event_target:horoscope_child = { has_character_flag = encouraged_horoscope_pattern has_character_flag = embraced_destiny } }
    }
	desc = {
    	text = EVTDESC_MNM_1255_B
    	trigger = { event_target:horoscope_child = { has_character_flag = discouraged_horoscope_pattern has_character_flag = embraced_destiny } }
    }
    desc = {
    	text = EVTDESC_MNM_1255_C
    	trigger = { event_target:horoscope_child = { has_character_flag = encouraged_horoscope_pattern has_character_flag = refused_destiny } }
    }
	desc = {
    	text = EVTDESC_MNM_1255_D
    	trigger = { event_target:horoscope_child = { has_character_flag = discouraged_horoscope_pattern has_character_flag = refused_destiny } }
    }

    option = {
        name = EVTOPTA_MNM_1255 # Good! I believe the heavens have a plan for [horoscope_child.GetTitledFirstName]
        custom_tooltip = { text = EVTOPTA_MNM_1255_TT }
        hidden_effect = {
            event_target:horoscope_child = {
            	change_variable = { which = horoscope_destiny_points value = 2 }
    			character_event = { id = MNM.1297 days = 30 }
            }
    	}
    }
    option = {      
        name = EVTOPTB_MNM_1255 # Actually, I think the stars have something else in store for my [horoscope_child.GetDaugtherSon].
        custom_tooltip = { text = EVTOPTB_MNM_1255_TT }
        hidden_effect = {
        	event_target:horoscope_child = {
        		change_variable = { which = horoscope_destiny_points value = -2 }
    			character_event = { id = MNM.1297 days = 30 }
        	}
    	}
    }
}

character_event = { # Upgrade modifiers (for horoscope_child, fired from on_adulthood)
    id = MNM.1269
    hide_window = yes
    is_triggered_only = yes

    trigger = {
    	has_dlc = "Mystics"
		has_childhood_horoscope_modifier_trigger = yes
		NOT = { has_character_flag = avoided_destiny }
    }
    option = {      
        set_horoscope_modifier_effect = yes        
    }
}

character_event = { # Destiny fulfilled (for horoscope_child)
    id = MNM.1270
    picture = GFX_evt_state_diplomacy
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = encouraged_horoscope_pattern has_character_flag = embraced_destiny } }
    	text = EVTDESC_MNM_1270_A
    }
	desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = discouraged_horoscope_pattern has_character_flag = embraced_destiny } }
    	text = EVTDESC_MNM_1270_B
    }
    desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = encouraged_horoscope_pattern has_character_flag = refused_destiny } }
    	text = EVTDESC_MNM_1270_C
    }
	desc = {
    	trigger = { event_target:horoscope_child = { has_character_flag = discouraged_horoscope_pattern has_character_flag = refused_destiny } }
    	text = EVTDESC_MNM_1270_D
    }

    option = {      
        name = EVTOPTA_MNM_1270 # Destiny fulfilled
		trigger = { has_top_tier_education_trait_trigger = no }
		trigger_switch = {
			on_trigger = has_character_flag
			destined_steward = {
				if = { limit = { has_education_stewardship_trigger = yes }
					upgrade_education_stewarship_effect = yes
				}
				if = { limit = { has_education_stewardship_trigger = no }
					change_stewardship = 1
				}
			}
			destined_fighter = {
				if = { limit = { has_education_martial_trigger = yes }
					upgrade_education_martial_effect = yes
				}
				if = { limit = { has_education_martial_trigger = no }
					change_martial = 1
				}
			}
			destined_diplomat = {
				if = { limit = { has_education_diplomacy_trigger = yes }
					upgrade_education_diplomacy_effect = yes
				}
				if = { limit = { has_education_diplomacy_trigger = no }
					change_diplomacy = 1
				}
			}
			destined_schemer = {
				if = { limit = { has_education_intrigue_trigger = yes }
					upgrade_education_intrigue_effect = yes
				}
				if = { limit = { has_education_intrigue_trigger = no }
					change_intrigue = 1
				}
			}
			destined_scholar = {
				if = { limit = { has_education_learning_trigger = yes }
					upgrade_education_learning_effect = yes
				}
				if = { limit = { has_education_learning_trigger = no }
					change_learning = 1
				}
			}
		}
    }
    option = {
        name = EVTOPTB_MNM_1270 # Destiny fulfilled (already maxed "correct" education)
		trigger = { has_top_tier_education_trait_trigger = yes }
		trigger_switch = {
			on_trigger = has_character_flag
			destined_steward = {
				if = { limit = { has_education_stewardship_trigger = yes }
					change_stewardship = 2
				}
				if = { limit = { has_education_stewardship_trigger = no }
					change_stewardship = 1
				}
			}
			destined_fighter = {
				if = { limit = { has_education_martial_trigger = yes }
					change_martial = 2
				}
				if = { limit = { has_education_martial_trigger = no }
					change_martial = 1
				}
			}
			destined_diplomat = {
				if = { limit = { has_education_diplomacy_trigger = yes }
					change_diplomacy = 2
				}
				if = { limit = { has_education_diplomacy_trigger = no }
					change_diplomacy = 1
				}
			}
			destined_schemer = {
				if = { limit = { has_education_intrigue_trigger = yes }
					change_intrigue = 2
				}
				if = { limit = { has_education_intrigue_trigger = no }
					change_intrigue = 1
				}
			}
			destined_scholar = {
				if = { limit = { has_education_learning_trigger = yes }
					change_learning = 2
				}
				if = { limit = { has_education_learning_trigger = no }
					change_learning = 1
				}
			}
		}
    }
    after = {
    	hidden_effect = {
    		event_target:horoscope_maker = {
	    		set_character_flag = child_fulfilled_destiny_flag
	    		character_event = { id = MNM.1265 }
	    	}
    		clean_up_horoscope_effect = yes
    	}
    }
}

character_event = { #Destiny avoided/backfired (for horoscope_child)
    id = MNM.1271
    picture = GFX_evt_secluded_in_prayer
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    trigger = {
    	has_dlc = "Mystics"
    }

    immediate = {
    	set_character_flag = avoided_destiny
    }

    desc = {
    	trigger = { has_character_flag = horoscope_maker_died }
    	text = EVTDESC_MNM_1271_A
    }
    desc = {
    	trigger = { NOT = { has_character_flag = horoscope_maker_died } }
    	text = EVTDESC_MNM_1271_B
    }

    option = {      
        name = EVTOPTA_MNM_1271 # I always had mixed feelings about this
        set_horoscope_modifier_effect = yes

    }
    after = {
		hidden_effect = {
	    	event_target:horoscope_maker = {
	    		set_character_flag = child_avoided_destiny_flag
	    		character_event = { id = MNM.1265 }
	    	}
			clean_up_horoscope_effect = yes
	    }
    }
}

character_event = { #Final follow-up for parent
    id = MNM.1265
    picture = GFX_evt_state_diplomacy
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes
    
    trigger = {
    	society_member_of = hermetics
    }

    desc = {
    	trigger = { has_character_flag = child_avoided_destiny_flag }
    	text = final_horoscope_outcome_for_parent_desc_1
    }
    desc = {
    	trigger = { has_character_flag = child_fulfilled_destiny_flag }
    	text = final_horoscope_outcome_for_parent_desc_2
    }

    option = {      
        name = fina_horoscope_outcome_for_parent_opt
        clr_character_flag = child_fulfilled_destiny_flag
        clr_character_flag = child_avoided_destiny_flag
    }
}

character_event = { # gating event for the horoscope_child (to check status of horoscope_maker - alive or no?)
    id = MNM.1297
    hide_window = yes
    is_triggered_only = yes
    
    trigger = { is_alive = yes }

    immediate = {
    	# If horoscope maker remains alive...
		if = {
            limit = { event_target:horoscope_maker = { is_alive = yes } }
			trigger_switch = {
    			on_trigger = has_character_flag # to determine which stage is on-going
				horoscope_destiny_revealed = {
					clr_character_flag = horoscope_destiny_revealed
					set_character_flag = horoscope_child_receives_horoscope
					event_target:horoscope_maker = { character_event = { id = MNM.1251 } } # for maker: the child is destined for grandeur within [horoscope_child.GetHermeticsDestinedExpertise]
				}
				horoscope_child_receives_horoscope = {
					if = { limit = { age = 4 }
						clr_character_flag = horoscope_child_receives_horoscope
						set_character_flag = horoscope_maker_receives_update
						character_event = { id = MNM.1252 } # for child: child learns of their destiny
					}
					if = { limit = { NOT = { age = 4 } }
						character_event = { id = MNM.1297 days = 365 } # for child: loops this to check back when old enough
					}
				}
				horoscope_maker_receives_update = {
					if = { limit = { age = 6 }
						clr_character_flag = horoscope_maker_receives_update
						set_character_flag = horoscope_child_contemplates_their_destiny
						event_target:horoscope_maker = { character_event = { id = MNM.1253 } } # for maker: the child is showing signs of talent
					}
					if = { limit = { NOT = { age = 6 } }
						character_event = { id = MNM.1297 days = 365 } # for child: loops this to check back when old enough
					}
				}
				horoscope_child_contemplates_their_destiny = {
					if = { limit = { age = 13 }
						clr_character_flag = horoscope_child_contemplates_their_destiny
						set_character_flag = horoscope_parent_is_informed
						character_event = { id = MNM.1254 } # for child: the child contemplates their "destiny"
					}
					if = { limit = { NOT = { age = 13 } }
						character_event = { id = MNM.1297 days = 365 } # for child: loops this to check back when old enough
					}
				}
				horoscope_parent_is_informed = {
					clr_character_flag = horoscope_parent_is_informed
					set_character_flag = horoscope_child_evaluate
					event_target:horoscope_maker = { character_event = { id = MNM.1255 } } # for maker: the child is embracing/or not their destiny
				}
				horoscope_child_evaluate = {
					character_event = { id = MNM.1298 } # for child: begin evaluating
				}
    		}
    		break = yes
        }

		# If horoscope maker died along the chain...

		set_character_flag = horoscope_maker_died
    	
    	trigger_switch = {
			on_trigger = has_character_flag # to determine which horoscope is on-going
			
			horoscope_destiny_revealed = { #nothing happens
				clr_character_flag = horoscope_destiny_revealed
				clean_up_horoscope_effect = yes
			}
			horoscope_child_receives_horoscope = {
				clr_character_flag = horoscope_child_receives_horoscope
				character_event = { id = MNM.1252 } # for child: child learns of their destiny (chain ENDS)
			}
			horoscope_maker_receives_update = {
				clr_character_flag = horoscope_maker_receives_update
				set_character_flag = horoscope_child_contemplates_their_destiny
				character_event = { id = MNM.1297 days = 365 } # for child: skips ahead to next step
			}
			horoscope_child_contemplates_their_destiny = {
				clr_character_flag = horoscope_child_contemplates_their_destiny
				if = { limit = { age = 13 }
					clr_character_flag = horoscope_child_contemplates_their_destiny
					set_character_flag = horoscope_parent_is_informed
					character_event = { id = MNM.1254 } # for child: the child contemplates their "destiny"
				}
				if = { limit = { NOT = { age = 13 } }
					character_event = { id = MNM.1297 days = 365 } # for child: loops this to check back when old enough
				}
			}
			horoscope_parent_is_informed = {
				clr_character_flag = horoscope_parent_is_informed
				set_character_flag = horoscope_child_evaluate
				character_event = { id = MNM.1297 days = 365 } # for child: skips ahead to next step
			}
			horoscope_child_evaluate = {
				character_event = { id = MNM.1298 } # for child: begin evaluating
			}
		}
    }
}

character_event = { # evaluate outcome (for horoscope_child, sends itself again if not fulfilled)
    id = MNM.1298
    hide_window = yes
    is_triggered_only = yes
    
    trigger = {
    	has_dlc = "Mystics"
    }

    immediate = {
		if = {
            limit = {
            	age = 17
                OR = {
                    check_variable = { which = horoscope_destiny_points value = 10 } 
                    NOT = { check_variable = { which = horoscope_destiny_points value = -10 } }
                }
            } 
            character_event = { id = MNM.1299 } #Destiny fulfilled/avoided
        }

     	if = {
            limit = {
            	OR = {
            		NOT = { age = 17 }
	                NOR = {
	                    check_variable = { which = horoscope_destiny_points value = 10 } 
	                    NOT = { check_variable = { which = horoscope_destiny_points value = -10 } }
	                }
            	}
            }

    		if = {
    			limit = { is_dumb_trigger = no }
            	change_variable = { which = horoscope_destiny_points value = 1 } #slowly ticking upwards
			}
			if = {
    			limit = { is_dumb_trigger = yes }
            	subtract_variable = { which = horoscope_destiny_points value = 1 } #slowly ticking downwards
			}

			character_event = { id = MNM.1297 days = 365 random = 100 } #Destiny NOT fulfilled/avoided (send gating event again...)
        }   
    }
}

#Fulfilling/Avoiding Horoscope Destiny
character_event = {
    id = MNM.1299
    hide_window = yes

    is_triggered_only = yes

    immediate = {
        if = {
            limit = { check_variable = { which = horoscope_destiny_points value = 10 } }
            character_event = { id = MNM.1270 } # fulfilled destiny
        }
        if = {
            limit = { NOT = { check_variable = { which = horoscope_destiny_points value = -10 } } }
            character_event = { id = MNM.1271 } # avoided destiny
        }
    }
}

###Power: Happiness potion
#Gating event to check amount of/which ingredients used
character_event = {
    id = MNM.5115
    picture = GFX_evt_experiment
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    desc = {
    	text = EVTDESC_MNM_5115_self
    	trigger = { has_character_flag = potion_target_is_self }
    }
    desc = {
    	text = EVTDESC_MNM_5115_other
    	trigger = { NOT = { has_character_flag = potion_target_is_self } }
    }

    immediate = {
    	#Selects two ingredients...
    	select_random_hermetic_ingredient_effect = yes
    	select_random_hermetic_ingredient_effect = yes
    }

    option = { # I will use ingredient 1
		name = {
        	text = EVTOPTA_MNM_5115_herb
        	trigger = { has_selected_herb_ingredient_1_trigger = yes }
        }
        name = {
        	text = EVTOPTA_MNM_5115_animal_part
        	trigger = { has_selected_animal_part_ingredient_1_trigger = yes }
        }		
        name = {
        	text = EVTOPTA_MNM_5115_powder
        	trigger = { has_selected_powder_ingredient_1_trigger = yes }
        }
        name = {
        	text = EVTOPTA_MNM_5115_liquid
        	trigger = { has_selected_liquid_ingredient_1_trigger = yes }
        }
		calculate_health_level_of_ingredient_1_effect = yes
		destroy_selected_ingredient_1_effect = yes

		ai_chance = { factor = 0 }

		trigger = {
			selected_ingredient_1_and_2_are_same = no
		}        
    }

	option = { # I will use ingredient 2
		name = {
        	text = EVTOPTB_MNM_5115_herb
        	trigger = { has_selected_herb_ingredient_2_trigger = yes }
        }
        name = {
        	text = EVTOPTB_MNM_5115_animal_part
        	trigger = { has_selected_animal_part_ingredient_2_trigger = yes }
        }		
        name = {
        	text = EVTOPTB_MNM_5115_powder
        	trigger = { has_selected_powder_ingredient_2_trigger = yes }
        }
        name = {
        	text = EVTOPTB_MNM_5115_liquid
        	trigger = { has_selected_liquid_ingredient_2_trigger = yes }
        }
		calculate_health_level_of_ingredient_2_effect = yes
        destroy_selected_ingredient_2_effect = yes

        ai_chance = { factor = 0 }
		
		trigger = {
        	has_selected_ingredient_2_trigger = yes
        	selected_ingredient_1_and_2_are_same = no
        }
    }

    option = { # I will only use one <ingredient_type_X> (IF DUPLICATE SELECTIONS)
		name = {
        	text = EVTOPTC_MNM_5115_herb
        	trigger = { has_selected_herb_ingredient_1_trigger = yes }
        }
        name = {
        	text = EVTOPTC_MNM_5115_animal_part
        	trigger = { has_selected_animal_part_ingredient_1_trigger = yes }
        }		
        name = {
        	text = EVTOPTC_MNM_5115_powder
        	trigger = { has_selected_powder_ingredient_1_trigger = yes }
        }
        name = {
        	text = EVTOPTC_MNM_5115_liquid
        	trigger = { has_selected_liquid_ingredient_1_trigger = yes }
        }
		calculate_health_level_of_ingredient_1_effect = yes
        destroy_selected_ingredient_1_effect = yes

        ai_chance = { factor = 0 }
		
		trigger = {
        	has_selected_ingredient_2_trigger = yes
        	selected_ingredient_1_and_2_are_same = yes
        }        
    }

    option = { #I will use ingredient 1 and 2
        name = {
        	text = EVTOPTD_MNM_5115
        	trigger = {	selected_ingredient_1_and_2_are_same = no }
        }
        name = {
        	text = EVTOPTD_MNM_5115_duplicate
        	trigger = {	selected_ingredient_1_and_2_are_same = yes }
        }

        calculate_health_level_of_ingredient_1_and_2_effect = yes
        
        destroy_selected_ingredient_1_and_2_effect = yes

        ai_chance = { factor = 25 }

        trigger = {
        	has_selected_ingredient_2_trigger = yes
        }
    }

    option = { #I'll throw a bit of everything in there!
        name = EVTOPTE_MNM_5115
        custom_tooltip = { text = EVTOPTE_MNM_5115_tt }

        calculate_health_level_of_all_ingredients_effect = yes

		destroy_all_ingredients_effect = yes

		ai_chance = { factor = 100 }

    	trigger = {
        	any_artifact = {
        		count = 4
        		has_artifact_flag = ingredient
        	}
        }
    }

    after = {
    	remove_selection_of_ingredients_effect = yes

    	hidden_effect = {
    		if = {
    			limit = { has_character_flag = potion_target_is_self }
    			character_event = { id = MNM.1400 days = 15 }
    		}
    		if = {
    			limit = { NOT = { has_character_flag = potion_target_is_self } }
    			clr_character_flag = preparing_potion
    			event_target:potion_target = { character_event = { id = MNM.1401 days = 10 } }
    		}
    		clr_character_flag = potion_target_is_self
    	}
    }
}

#Giving the potion to yourself
character_event = {
    id = MNM.1400
    desc = EVTDESC_MNM_1400
    picture = GFX_evt_experiment
    border = GFX_event_normal_frame_religion

    hide_from = yes

    is_triggered_only = yes
    
    option = { 
        name = EVTOPTA_MNM_1400

        if = { 
			limit = { trait = stressed }
			remove_trait = stressed
		}
		if = { 
			limit = { trait = depressed }
			remove_trait = depressed
		}
		if = {
			limit = { has_character_modifier = apathetic }
			remove_character_modifier = apathetic
		}

		hidden_effect = {
			clr_character_flag = preparing_potion
			random = {
				chance = 40
				modifier = {
					factor = 0.5
					check_variable = { which = current_potion_quality value = 1 }
				}
				modifier = {
					factor = 0.5
					check_variable = { which = current_potion_quality value = 2 }
				}
				modifier = {
					factor = 0.5
					check_variable = { which = current_potion_quality value = 4 }
				}
				modifier = {
					factor = 0.5
					check_variable = { which = current_potion_quality value = 6 }
				}
				modifier = {
					factor = 1.1
					NOT = { check_variable = { which = current_potion_quality value = -1 } }
				}
				modifier = {
					factor = 1.2
					NOT = { check_variable = { which = current_potion_quality value = -2 } }
				}
				modifier = {
					factor = 1.3
					NOT = { check_variable = { which = current_potion_quality value = -4 } }
				}
				modifier = {
					factor = 1.4
					NOT = { check_variable = { which = current_potion_quality value = -6 } }
				}
				character_event = { id = MNM.1403 days = 150 random = 600 }
			}

        	set_variable = { # Reset potion quality
    			which = current_potion_quality
    			value = 0
    		}
		} 
    }
}

#The other person gets offered a potion
character_event = {
    id = MNM.1401
    desc = EVTDESC_MNM_1401
    picture = GFX_evt_experiment
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes
    
    option = { 
        name = EVTOPTA_MNM_1401
        custom_tooltip = { text = EVTOPTA_MNM_1401_TT }

        tooltip = {
	        if = { 
				limit = { trait = stressed }
				remove_trait = stressed
			}
			if = { 
				limit = { trait = depressed }
				remove_trait = depressed
			}
			if = {
				limit = { has_character_modifier = apathetic }
				remove_character_modifier = apathetic
			}
        }

		hidden_effect = { FROM = { character_event = { id = MNM.1402 } } }

		ai_chance = {
			factor = 50
			modifier = {
				society_member_of = hermetics
				factor = 3
			}
		}
    }

    option = {
        name = EVTOPTB_MNM_1401
        custom_tooltip = { text = EVTOPTB_MNM_1401_TT }

        reverse_opinion = {
        	who = FROM
        	modifier = opinion_ungrateful
        }
        #Does not give follow-up because if a player recieves this, the sender is a courtier

        ai_chance = {
			factor = 50
			modifier = {
				trait = zealous
				factor = 3
			}
			modifier = {
				liege = { character = FROM } #A player will always get a yes
				factor = 0
			}
		}
    }
}


#Giving the potion to someone else 
character_event = {
    id = MNM.1402
    desc = EVTDESC_MNM_1402
    picture = GFX_evt_experiment
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes
    
    option = { 
        name = EVTOPTA_MNM_1402

        
    	FROM = {
	        if = { 
				limit = { trait = stressed }
				remove_trait = stressed
			}
			if = { 
				limit = { trait = depressed }
				remove_trait = depressed
			}
			if = {
				limit = { has_character_modifier = apathetic }
				remove_character_modifier = apathetic
			}

			hidden_effect = {
				random = {
					chance = 20
					modifier = {
						factor = 0.5
						ROOT = { check_variable = { which = current_potion_quality value = 1 } }
					}
					modifier = {
						factor = 0.5
						ROOT = { check_variable = { which = current_potion_quality value = 2 } }
					}
					modifier = {
						factor = 0.5
						ROOT = { check_variable = { which = current_potion_quality value = 4 } }
					}
					modifier = {
						factor = 0.5
						ROOT = { check_variable = { which = current_potion_quality value = 6 } }
					}
					modifier = {
						factor = 1.1
						ROOT = { NOT = { check_variable = { which = current_potion_quality value = -1 } } }
					}
					modifier = {
						factor = 1.2
						ROOT = { NOT = { check_variable = { which = current_potion_quality value = -2 } } }
					}
					modifier = {
						factor = 1.3
						ROOT = { NOT = { check_variable = { which = current_potion_quality value = -4 } } }
					}
					modifier = {
						factor = 1.4
						ROOT = { NOT = { check_variable = { which = current_potion_quality value = -6 } } }
					}
					character_event = { id = MNM.1403 days = 150 random = 600 }  
				}
			} 
    	}
        hidden_effect = {
        	set_variable = { # Reset potion quality
    			which = current_potion_quality
    			value = 0
    		}
    	}

        reverse_opinion = {
        	who = FROM
        	modifier = opinion_grateful
        }

    }
}

#The good effect didn't last
character_event = {
    id = MNM.1403
    desc = EVTDESC_MNM_1403
    picture = GFX_evt_illness
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

    trigger = { NOT = { trait = depressed } }

    option = { 
        name = EVTOPTA_MNM_1403

        add_trait = depressed

        add_character_modifier = {
        	name = apathetic
        	years = 5
        }
    }
}

####################################################
# MAGUS: POWER - Choose Hermetic Art/Lifestyle trait
####################################################
# No Previous Lifestyle trait - Choose one
character_event = {
	id = MNM.1900
	desc = EVTDESC_MNM_1900
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = { # Choose Astrology/Scholar
		name = EVTOPTA_MNM_1900
		
		custom_tooltip = {
			text = EVTOPTA_MNM_1900_TOOLTIP
			character_event = { id = MNM.1902 days = 10 random = 20 }
		}
		
		ai_chance = {
			factor = 1
			modifier = {
				factor = 5
				trait = cynical
			}
			modifier = {
				factor = 3
				trait = erudite
			}
		}
	}
	
	option = { # Choose Alchemy/Mystic
		name = EVTOPTB_MNM_1900
		
		custom_tooltip = {
			text = EVTOPTB_MNM_1900_TOOLTIP
			character_event = { id = MNM.1904 days = 10 random = 20 }
		}
		
		ai_chance = {
			factor = 1
			modifier = {
				factor = 5
				trait = cynical
			}
		}
	}
	
	option = { # Choose Theurgy/Theologian
		name = EVTOPTC_MNM_1900
		
		custom_tooltip = {
			text = EVTOPTC_MNM_1900_TOOLTIP
			character_event = { id = MNM.1906 days = 10 random = 20 }
		}
		
		ai_chance = {
			factor = 1
			modifier = {
				factor = 5
				trait = zealous
			}
		}
	}
	
	option = { # Change your mind
		name = EVTOPTD_MNM_1900
		
		add_society_currency_minor_effect = yes
		clr_character_flag = choosing_hermetic_art
	}
}

# Has either Scholar, Mystic, or Theologian already - Replace the existing trait
character_event = {
	id = MNM.1901
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	desc = {
		trigger = { trait = scholar }
		picture = GFX_evt_comet
		text = EVTDESCA_MNM_1901
	}
	
	desc = {
		trigger = { trait = mystic }
		picture = GFX_evt_experiment
		text = EVTDESCB_MNM_1901
	}
	
	desc = {
		trigger = { trait = theologian }
		picture = GFX_evt_secluded_in_prayer
		text = EVTDESCC_MNM_1901
	}
	
	option = { # Change to Astrology/Scholar
		name = EVTOPTA_MNM_1901
		
		trigger = {
			NOT = { trait = scholar }
		}
		
		if = {
			limit = { trait = mystic }
			remove_trait = mystic
		}
		if = {
			limit = { trait = theologian }
			remove_trait = theologian
		}
		add_trait = scholar
		clr_character_flag = choosing_hermetic_art
	}
	
	option = { # Change to Alchemy/Mystic
		name = EVTOPTB_MNM_1901
		
		trigger = {
			NOT = { trait = mystic }
		}
		
		if = {
			limit = { trait = scholar }
			remove_trait = scholar
		}
		if = {
			limit = { trait = theologian }
			remove_trait = theologian
		}
		add_trait = mystic
		clr_character_flag = choosing_hermetic_art
	}
	
	option = { # Change to Theurgy/Theologian
		name = EVTOPTC_MNM_1901
		
		trigger = {
			NOT = { trait = theologian }
		}
		
		if = {
			limit = { trait = scholar }
			remove_trait = scholar
		}
		if = {
			limit = { trait = mystic }
			remove_trait = mystic
		}
		add_trait = theologian
		clr_character_flag = choosing_hermetic_art
	}
	
	option = { # Change your mind
		name = EVTOPTD_MNM_1901
		
		add_society_currency_minor_effect = yes
		clr_character_flag = choosing_hermetic_art
	}
}

# Become Scholar
character_event = {
	id = MNM.1902
	desc = EVTDESC_MNM_1902
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1902
		
		if = {
			limit = {
				has_character_flag = owns_observatory_equipment
			}
			custom_tooltip = {
				text = CUSTOM_TOOLTIP_OWNS_OBSERVATORY_EQUIPMENT
			}
			if = {
				limit = {
					NOT = { trait = diligent }
					NOT = { trait = slothful }
				}
				add_trait = diligent
			}
			if = {
				limit = {
					trait = slothful
				}
				remove_trait = slothful
			}
			prestige = 25
			add_character_modifier = {
				modifier = stargazer
				duration = 3650
			}
		}
		if = {
			limit = {
				NOT = { has_character_flag = owns_observatory_equipment }
			}
			custom_tooltip = {
				text = CUSTOM_TOOLTIP_BUY_OBSERVATORY_EQUIPMENT
			}
			set_character_flag = owns_observatory_equipment
			scaled_wealth = { value = -0.4 min = -40 }
			if = {
				limit = {
					NOT = { trait = diligent }
					NOT = { trait = slothful }
				}
				add_trait = diligent
			}
			if = {
				limit = {
					trait = slothful
				}
				remove_trait = slothful
			}
			add_character_modifier = {
				modifier = stargazer
				duration = 3650
			}
		}
		character_event = { id = MNM.1903 days = 60 random = 30 }
		
		ai_chance = {
			factor = 1
		}
	}
	
	option = {
		name = EVTOPTB_MNM_1902
		
		random_list = {
			50 = { change_learning = 1 }
			40 = {
				modifier = {
					factor = 0
					trait = erudite
				}
				add_trait = erudite
			}
			10 = {
				modifier = {
					factor = 0
					OR = {
						trait = shrewd
						trait = dull
					}
				}
				add_trait = shrewd
			}
		}
		character_event = { id = MNM.1903 days = 60 random = 30 }
		
		ai_chance = {
			factor = 1
			modifier = {
				factor = 2
				trait = erudite
			}
		}
	}
}

character_event = {
	id = MNM.1903
	desc = EVTDESC_MNM_1903
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	option = {
		name = EVTOPTA_MNM_1903
		
		hidden_tooltip = {
			if = {
				limit = {
					lifestyle_traits = 1
				}
				remove_lifestyle_trait_effect = yes
			}
		}
		add_trait = scholar
		clr_character_flag = choosing_hermetic_art
	}
}

# Become Mystic
character_event = {
	id = MNM.1904
	desc = EVTDESC_MNM_1904
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1904
		
		if = {
			limit = {
				NOT = { trait = diligent }
				NOT = { trait = slothful }
			}
			add_trait = diligent
		}
		if = {
			limit = {
				trait = slothful
			}
			remove_trait = slothful
		}
		add_character_modifier = {
			modifier = experimenting_alchemist
			duration = 3650
		}
		character_event = { id = MNM.1905 days = 60 random = 30 }
		
		ai_chance = {
			factor = 1
			modifier = {
				factor = 4
				trait = brave
			}
			modifier = {
				factor = 3
				trait = ambitious
			}
		}
	}
	
	option = {
		name = EVTOPTB_MNM_1904
		
		if = {
			limit = {
				NOT = { trait = patient }
				NOT = { trait = wroth }
			}
			add_trait = patient
		}
		if = {
			limit = {
				trait = wroth
			}
			remove_trait = wroth
		}
		add_character_modifier = {
			modifier = theoretical_alchemist
			duration = 3650
		}
		character_event = { id = MNM.1905 days = 60 random = 30 }
		
		ai_chance = {
			factor = 1
			modifier = {
				factor = 4
				trait = craven
			}
			modifier = {
				factor = 3
				trait = erudite
			}
		}
	}
}

character_event = {
	id = MNM.1905
	desc = EVTDESC_MNM_1905
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1905
		
		hidden_tooltip = {
			if = {
				limit = {
					lifestyle_traits = 1
				}
				remove_lifestyle_trait_effect = yes
			}
		}
		add_trait = mystic
		clr_character_flag = choosing_hermetic_art
	}
}

# Become Theologian
character_event = {
	id = MNM.1906
	desc = EVTDESC_MNM_1906
	picture = GFX_evt_secluded_in_prayer
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1906
		
		add_character_modifier = {
			modifier = divine_spirit_alliance
			duration = 3650
		}
		character_event = { id = MNM.1907 days = 60 random = 30 }
		
		ai_chance = {
			factor = 1
			modifier = {
				factor = 4
				trait = zealous
			}
			modifier = {
				factor = 4
				trait = honest
			}
		}
	}
	
	option = {
		name = EVTOPTB_MNM_1906
		
		add_character_modifier = {
			modifier = demon_alliance
			duration = 3650
		}
		character_event = { id = MNM.1907 days = 60 random = 30 }
		
		ai_chance = {
			factor = 1
			modifier = {
				factor = 5
				trait = deceitful
			}
			modifier = {
				factor = 3
				trait = cynical
			}
		}
	}
}

character_event = {
	id = MNM.1907
	desc = EVTDESC_MNM_1907
	picture = GFX_evt_secluded_in_prayer
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1907
		
		hidden_tooltip = {
			if = {
				limit = {
					lifestyle_traits = 1
				}
				remove_lifestyle_trait_effect = yes
			}
		}
		add_trait = theologian
		clr_character_flag = choosing_hermetic_art
	}
}
################
# INTERACTIONS
################
#The flags hidden_lab and very_hidden_lab can be used for events about stealing secrets from others/having your secrets stolen.

#Interaction: Gathering of the Great Minds
character_event = {		
    id = MNM.1460
    desc = EVTDESC_MNM_1460
    picture = GFX_evt_gathering_of_minds
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes
    capable_only = yes

    trigger = {
    	society_member_of = hermetics
    	society_rank >= 2
    	learning = 10
    	OR = {
    		martial = 8
    		stewardship = 8
    	}
    	is_landed = yes
    	has_character_flag = built_laboratory
    	war = no
    	block_general_event_trigger = no
    	NOT = { has_character_flag = gathering_of_the_minds }
    	any_society_member = {
    		count = 4
    		opinion = { who = ROOT value = 15 }
			reverse_opinion = { who = ROOT value = 15 }
    	}
    }

    option = { 
        name = EVTOPTA_MNM_1460
        custom_tooltip = { text = EVTOPTA_MNM_1460_TT }
        scaled_wealth = { value = -0.5 min = -20 }
        hidden_effect = { 
        	character_event = { id = MNM.1461 days = 7 } 
        	set_character_flag = gathering_of_the_minds
        }
    }

    option = {
        name = EVTOPTB_MNM_1460
    }
}

#Send out letters
character_event = {
    id = MNM.1461
    desc = EVTDESC_MNM_1461
    picture = GFX_evt_recieve_letter
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes
    hide_from = yes

    trigger = { has_character_flag =  gathering_of_the_minds }

    immediate = {
    	hidden_effect = {
	    	#Guest of honor (1)
	    	random_list = {
	    		50 = {
	    			trigger = { society = { any_society_member = { is_friend = ROOT  ai = yes } } }
	    			society = { random_society_member = { limit = { is_friend = ROOT ai = yes } save_event_target_as = great_minds_guest_1 } }
	    		} 
	    		50 = {
	    			trigger = { 
	    				society = { 
	    					any_society_member = { 
	    						ai = yes
	    						OR = {
	    							learning = 16
	    							society_rank == 4
	    						}
	    						is_within_diplo_range = ROOT
	    						opinion = { who = ROOT value = 20 }
	    						reverse_opinion = { who = ROOT value = 20 }
	    					}
	    				}
	    			}
	    			society = {
		    			random_society_member = {
		    				limit = {
		    					ai = yes
		    					OR = {
	    							learning = 16
	    							society_rank == 4
	    						}
	    						is_within_diplo_range = ROOT
	    						opinion = { who = ROOT value = 20 }
	    						reverse_opinion = { who = ROOT value = 20 }
		    				}
		    				save_event_target_as = great_minds_guest_1
		    			}
	    			}
	    		}
	    		1 = {
	    			society = {
				    	random_society_member = {
				    		limit = {
				    			ai = yes
				    			opinion = { who = ROOT value = 15 }
				    			reverse_opinion = { who = ROOT value = 15 }
				    		}
				    		save_event_target_as = great_minds_guest_1
				    	}
			    	}
	    		}
	    	}
    	}

    	#Guest 2
    	society = {
	    	random_society_member = {
	    		limit = {
	    			ai = yes
	    			NOT = { character = event_target:great_minds_guest_1 }
	    			opinion = { who = ROOT value = 15 }
	    			reverse_opinion = { who = ROOT value = 15 }
	    		}
	    		save_event_target_as = great_minds_guest_2
	    	}
    	}

    	#Guest 3 and 4
    	random_list = {
    		70 = { #Your rival gets invited
    			trigger = { society = { any_society_member = { ai = yes NOT = { reverse_opinion = { who = ROOT value = -30 } } } } }
    			set_character_flag = disliked_hermetic_colleague

    			society = {
    				random_society_member = {
    					limit = { ai = yes NOT = { reverse_opinion = { who = ROOT value = -30 } } }
    					save_event_target_as = great_minds_guest_4
    				}

    				random_society_member = {
						limit = {
							ai = yes
							opinion = { who = event_target:great_minds_guest_4 value = 20 }
							reverse_opinion = { who = ROOT value = 15 }
							NOR = {
								character = event_target:great_minds_guest_1
								character = event_target:great_minds_guest_2
							}
						}
						save_event_target_as = great_minds_guest_3
					}
    			}
    			if = {
    				limit = { NOT = { event_target:great_minds_guest_3 = { always = yes } } }
    				society = {
				    	random_society_member = {
				    		limit = {
				    			ai = yes
				    			NOR = {
									character = event_target:great_minds_guest_1
									character = event_target:great_minds_guest_2
								}
				    			opinion = { who = ROOT value = 15 }
				    			reverse_opinion = { who = ROOT value = 15 }
				    		}
				    		save_event_target_as = great_minds_guest_3
				    	}
			    	}
    			}
    		}
    		30 = { #Nothing special
    			society = {
			    	random_society_member = {
			    		limit = {
			    			ai = yes
			    			NOR = {
								character = event_target:great_minds_guest_1
								character = event_target:great_minds_guest_2
							}
			    			opinion = { who = ROOT value = 15 }
			    			reverse_opinion = { who = ROOT value = 15 }
			    		}
			    		save_event_target_as = great_minds_guest_3
			    	}
		    	}
		    	society = {
			    	random_society_member = {
			    		limit = {
			    			ai = yes
			    			NOR = {
								character = event_target:great_minds_guest_1
								character = event_target:great_minds_guest_2
								character = event_target:great_minds_guest_3
							}
			    			opinion = { who = ROOT value = 15 }
			    			reverse_opinion = { who = ROOT value = 15 }
			    		}
			    		save_event_target_as = great_minds_guest_4
			    	}
		    	}
    		}
    	}
    }

    option = { 
        name = EVTOPTA_MNM_1461

        reverse_opinion = { who = event_target:great_minds_guest_1 modifier = opinion_grateful_invitation months = 3 }
        reverse_opinion = { who = event_target:great_minds_guest_2 modifier = opinion_grateful_invitation months = 3 }
        reverse_opinion = { who = event_target:great_minds_guest_3 modifier = opinion_grateful_invitation months = 3 }
        if = {
        	limit = { NOT = { has_character_flag = disliked_hermetic_colleague } }
        	reverse_opinion = { who = event_target:great_minds_guest_4 modifier = opinion_grateful_invitation months = 3 }
        }
        hidden_effect = {
	        if = {
	        	limit = { has_character_flag = disliked_hermetic_colleague }
	        	event_target:great_minds_guest_3 = { character_event = { id = MNM.1462 days = 10 } }
	        	clr_character_flag = disliked_hermetic_colleague
	        	break = yes
	        }
	        character_event = { id = MNM.1464 days = 30 }
	    }
    }
}

#Ping to rival inviter
character_event = {
    id = MNM.1462
    hide_window = yes
    is_triggered_only = yes
    immediate = { FROM = { letter_event = { id = MNM.1463 } } }
}

#Another guests wants rival to come
letter_event = {
    id = MNM.1463
    desc = EVTDESC_MNM_1463
    border = GFX_event_letter_frame_religion

    is_triggered_only = yes

    trigger = { has_character_flag =  gathering_of_the_minds }
    
    #Diplomatic excuse
    option = {
    	trigger = { diplomacy = 12 }
    	tooltip_info = diplomacy
        name = EVTOPTD_MNM_1463
        custom_tooltip = { text = EVTOPTD_MNM_1463_TT }

        clear_event_target = great_minds_guest_4

    }

    #I guess they can come
  	option = { 
        name = EVTOPTA_MNM_1463
        custom_tooltip = { text = EVTOPTA_MNM_1463_TT }

        event_target:great_minds_guest_4 = {
        	set_character_flag = show_in_option
        	clr_character_flag = show_in_option
        }

        reverse_opinion = { who = FROM modifier = opinion_grateful years = 3 }
    }

    #I don't want them here
    option = {
        name = EVTOPTB_MNM_1463
        custom_tooltip = { text = EVTOPTB_MNM_1463_TT }

        clear_event_target = great_minds_guest_4

        hidden_effect = { character_event = { id = MNM.1480 } } #Handles scandals

        reverse_opinion = { who = FROM modifier = opinion_very_disappointed years = 3 }
    }
    
    #Neither are invited!
    option = {
        name = EVTOPTC_MNM_1463
        custom_tooltip = { text = EVTOPTC_MNM_1463_TT }

        clear_event_target = great_minds_guest_3
        clear_event_target = great_minds_guest_4

        set_character_flag = hermetics_minor_scandal #Will be upgraded to major in 1480
        hidden_effect = { character_event = { id = MNM.1480 } } #Handles scandals

        reverse_opinion = { who = FROM modifier = opinion_offended years = 10 }
    }

    after = {
    	hidden_effect = { character_event = { id = MNM.1464 days = 20 } }
    }
}

#You suggest what you make
character_event = {
    id = MNM.1464
    desc = EVTDESC_MNM_1464
    picture = GFX_evt_gathering_of_minds
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes
    hide_from = yes

    trigger = { has_character_flag =  gathering_of_the_minds }

    #Something for war (handgun, giant crossbow, plate armor)
    option = { 
    	trigger = { martial = 8 }
    	tooltip_info = martial
        name = EVTOPTA_MNM_1464
        custom_tooltip = { text = EVTOPTA_MNM_1464_TT }
        set_character_flag = war_invention
    }

    #Something for prosperity (mill, compass, blast furnace)
    option = {
    	trigger = { stewardship = 8 }
    	tooltip_info = stewardship
        name = EVTOPTB_MNM_1464
        custom_tooltip = { text = EVTOPTB_MNM_1464_TT }
        set_character_flag = prosperity_invention
    }
    
    #Something for learning (glassess, cross staff, cipher disc)
    option = {
    	tooltip_info = learning
        name = EVTOPTD_MNM_1464
        custom_tooltip = { text = EVTOPTD_MNM_1464_TT }
        set_character_flag = knowledge_invention
    }

    after = {
    	hidden_effect = {
	    	random_list = { 
	    		50 = {
	    			trigger = {
	    				always = yes
	    				OR = {
	    					event_target:great_minds_guest_1 = { NOT = { opinion = { who = ROOT value = 10 } } }
	    					event_target:great_minds_guest_1 = { is_dumb_trigger = yes }
	    					event_target:great_minds_guest_1 = { trait = ambitious }
	    				}
	    			}
	    			modifier = { is_rival = event_target:great_minds_guest_1 factor = 3 }
	    			event_target:great_minds_guest_1 = { character_event = { id = MNM.1465 days = 3 } }
	    		}
	    		50 = {
	    			trigger = {
	    				always = yes
	    				OR = {
	    					event_target:great_minds_guest_2 = { NOT = { opinion = { who = ROOT value = 10 } } }
	    					event_target:great_minds_guest_2 = { is_dumb_trigger = yes }
	    					event_target:great_minds_guest_2 = { trait = ambitious }
	    				}
	    			}
	    			modifier = { is_rival = event_target:great_minds_guest_2 factor = 3 }
	    			event_target:great_minds_guest_2 = { character_event = { id = MNM.1465 days = 3 } }
	    		}
	    		50 = {
	    			trigger = {
	    				always = yes
	    				OR = {
	    					event_target:great_minds_guest_3 = { NOT = { opinion = { who = ROOT value = 10 } } }
	    					event_target:great_minds_guest_3 = { is_dumb_trigger = yes }
	    					event_target:great_minds_guest_3 = { trait = ambitious }
	    				}
	    			}
	    			modifier = { is_rival = event_target:great_minds_guest_3 factor = 3 }
	    			event_target:great_minds_guest_3 = { character_event = { id = MNM.1465 days = 3 } }
	    		}
	    		50 = {
	    			trigger = {
	    				always = yes
	    				OR = {
	    					event_target:great_minds_guest_4 = { NOT = { opinion = { who = ROOT value = 10 } } }
	    					event_target:great_minds_guest_4 = { is_dumb_trigger = yes }
	    					event_target:great_minds_guest_4 = { trait = ambitious }
	    				}
	    			}
	    			modifier = { is_rival = event_target:great_minds_guest_4 factor = 3 }
	    			event_target:great_minds_guest_4 = { character_event = { id = MNM.1465 days = 3 } }
	    		}
	    		50 = { #They agree
	    			character_event = { id = MNM.1467 days = 3 }
	    		}
	    	}
	    }
    }
}


#Someone protests (ping)
character_event = {
    id = MNM.1465
    hide_window = yes
    is_triggered_only = yes
    immediate = { FROM = { character_event = { id = MNM.1466 } } }
}
		
#Someone protests and has their own suggestion
character_event = {
    id = MNM.1466
    desc = EVTDESC_MNM_1466
    picture = GFX_evt_quarrel
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

    trigger = { has_character_flag =  gathering_of_the_minds }
    
    immediate = {
    	FROM = {
	    	random_list = {
	    		33 = {
	    			trigger = { NOT = { ROOT = { has_character_flag = war_invention } } }
	    			modifier = { has_education_martial_trigger = yes factor = 1.5 }
	    			modifier = { has_lifestyle_martial_trigger = yes factor = 1.5 }
	    			set_character_flag = war_invention
	    		}
	    		33 = {
	    			trigger = { NOT = { ROOT = { has_character_flag = prosperity_invention } } }
	    			modifier = { has_education_stewardship_trigger = yes factor = 1.5 }
	    			modifier = { has_lifestyle_stewardship_trigger = yes factor = 1.5 }
	    			set_character_flag = prosperity_invention
	    		}
	    		33 = {
	    			trigger = { NOT = { ROOT = { has_character_flag = knowledge_invention } } }
	    			modifier = { has_education_learning_trigger = yes factor = 1.5 }
	    			modifier = { has_lifestyle_learning_trigger = yes factor = 1.5 }
	    			set_character_flag = knowledge_invention
	    		}
	    	}
    	}
    }

    #Debate them
    option = { 
    	trigger = { learning = 12 }
        name = EVTOPTA_MNM_1466
        custom_tooltip = { text = EVTOPTA_MNM_1466_TT }

        random_list = {
        	50 = { #You win
        		modifier = { learning = 8 factor = 1.2 }
        		modifier = { learning = 10 factor = 1.2 }
        		modifier = { learning = 12 factor = 1.2 }
        		modifier = { learning = 14 factor = 1.2 }
        		modifier = { learning = 16 factor = 1.2 }
        		modifier = { learning = 18 factor = 1.2 }
        		modifier = { learning = 20 factor = 1.2 }
        		custom_tooltip = { text = EVTOPTA_MNM_1466_SUCCESS_TT }
        		hidden_effect = { character_event = { id = MNM.1468 days = 7 } }
        	}
        	50 = { #They win
        		modifier = { FROM = { learning = 8 } factor = 1.2 }
        		modifier = { FROM = { learning = 10 } factor = 1.2 }
        		modifier = { FROM = { learning = 12 } factor = 1.2 }
        		modifier = { FROM = { learning = 14 } factor = 1.2 }
        		modifier = { FROM = { learning = 16 } factor = 1.2 }
        		modifier = { FROM = { learning = 18 } factor = 1.2 }
        		modifier = { FROM = { learning = 20 } factor = 1.2 }
        		custom_tooltip = { text = EVTOPTA_MNM_1466_FAILURE_TT }
        		hidden_effect = { character_event = { id = MNM.1469 days = 7 } }
        	}
        }
    }

    #Agree, it begins
    option = {
        name = EVTOPTB_MNM_1466
        custom_tooltip = { text = EVTOPTB_MNM_1466_TT }

        hidden_effect = {
        	clr_character_flag = war_invention
        	clr_character_flag = prosperity_invention
        	clr_character_flag = knowledge_invention

        	if = {
        		limit = { FROM = { has_character_flag = war_invention } }
        		FROM = { clr_character_flag = war_invention }
        		set_character_flag = war_invention
        	}
        	if = {
        		limit = { FROM = { has_character_flag = prosperity_invention } }
        		FROM = { clr_character_flag = prosperity_invention }
        		set_character_flag = prosperity_invention
        	}
        	if = {
        		limit = { FROM = { has_character_flag = knowledge_invention } }
        		FROM = { clr_character_flag = knowledge_invention }
        		set_character_flag = knowledge_invention
        	}
        }
        hidden_effect = { character_event = { id = MNM.1470 days = 30 } }
    }
    
    #Forbid, it begins
    option = {
        name = EVTOPTC_MNM_1466
        custom_tooltip = { text = EVTOPTC_MNM_1466_TT } 

        reverse_opinion = { who = event_target:great_minds_guest_1 modifier = opinion_unreasonable years = 5 }
        reverse_opinion = { who = event_target:great_minds_guest_2 modifier = opinion_unreasonable years = 5 }
        if = {
        	limit = { event_target:great_minds_guest_3 = { always = yes } }
        	reverse_opinion = { who = event_target:great_minds_guest_3 modifier = opinion_unreasonable years = 5 }
        }
        if = {
        	limit = { event_target:great_minds_guest_4 = { always = yes } }
        	reverse_opinion = { who = event_target:great_minds_guest_4 modifier = opinion_unreasonable years = 5 }
        }
        hidden_effect = { 	
       		character_event = { id = MNM.1480 } 
       		character_event = { id = MNM.1470 days = 30 }
       	}
       	FROM = {
        	clr_character_flag = war_invention
        	clr_character_flag = prosperity_invention
        	clr_character_flag = knowledge_invention
        }
    }
}	

#They agreed, it begins
character_event = {
    id = MNM.1467
    desc = EVTDESC_MNM_1467
    picture = GFX_evt_gathering_of_minds
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes
    
    option = { 
        name = EVTOPTA_MNM_1467
        custom_tooltip = { text = EVTOPTA_MNM_1467_TT }

        hidden_effect = { character_event = { id = MNM.1470 days = 30 } }
    }
}	

#You won debate
character_event = {
    id = MNM.1468
    desc = EVTDESC_MNM_1468
    picture = GFX_evt_religious_exultation
    border = GFX_event_normal_frame_religion

    trigger = { has_character_flag =  gathering_of_the_minds }

    is_triggered_only = yes
    
    option = { 
        name = EVTOPTA_MNM_1468
        custom_tooltip = { text = EVTOPTA_MNM_1467_TT }

        add_society_currency_minor_effect = yes

        hidden_effect = { character_event = { id = MNM.1470 days = 30 } }

        FROMFROM = {
        	clr_character_flag = war_invention
        	clr_character_flag = prosperity_invention
        	clr_character_flag = knowledge_invention
        }
    }
}

#You lost debate
character_event = {
    id = MNM.1469
    desc = EVTDESC_MNM_1469
    picture = GFX_evt_rival_rulers
    border = GFX_event_normal_frame_religion

    trigger = { has_character_flag =  gathering_of_the_minds }

    is_triggered_only = yes
    
    option = { 
        name = EVTOPTA_MNM_1469
        custom_tooltip = { text = EVTOPTA_MNM_1469_TT }

        prestige = -50

        hidden_effect = {
        	clr_character_flag = war_invention
        	clr_character_flag = prosperity_invention
        	clr_character_flag = knowledge_invention

        	if = {
        		limit = { FROMFROM = { has_character_flag = war_invention } }
        		FROMFROM = { clr_character_flag = war_invention }
        		set_character_flag = war_invention
        	}
        	if = {
        		limit = { FROMFROM = { has_character_flag = prosperity_invention } }
        		FROMFROM = { clr_character_flag = prosperity_invention }
        		set_character_flag = prosperity_invention
        	}
        	if = {
        		limit = { FROMFROM = { has_character_flag = knowledge_invention } }
        		FROMFROM = { clr_character_flag = knowledge_invention }
        		set_character_flag = knowledge_invention
        	}
        }

       	hidden_effect = { character_event = { id = MNM.1470 days = 30 } }
    }
}

#Risky or safe project
character_event = {
    id = MNM.1470
    desc = EVTDESC_MNM_1470
    picture = GFX_evt_rival_rulers
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes
    hide_from = yes

    trigger = { has_character_flag =  gathering_of_the_minds }

    #The safer
    option = { 
        name = EVTOPTA_MNM_1470
        custom_tooltip = { text = EVTOPTA_MNM_1470_TT }

        reverse_opinion = { who = event_target:great_minds_guest_2 modifier = opinion_grateful years = 5 }
        reverse_opinion = { who = event_target:great_minds_guest_1 modifier = opinion_disappointed years = 5 }

        hidden_effect = { set_character_flag = safe_invention }
    }

    #The riskier
    option = {
        name = EVTOPTB_MNM_1470
        custom_tooltip = { text = EVTOPTB_MNM_1470_TT }

      	reverse_opinion = { who = event_target:great_minds_guest_1 modifier = opinion_grateful years = 5 }
       	reverse_opinion = { who = event_target:great_minds_guest_2 modifier = opinion_disappointed years = 5 }

       	hidden_effect = { set_character_flag = risky_invention }
    }

    after = {
    	hidden_effect = {
    		event_target:great_minds_guest_1 = {
    			opinion = { who = event_target:great_minds_guest_1 modifier = opinion_argued years = 5 }
    			reverse_opinion = { who = event_target:great_minds_guest_1 modifier = opinion_argued years = 5 }
    		}

    		#Things that might happen
    		random_list = {
    			40 = { #People fight
    				trigger = {
    					society = {
    						any_society_member = {
    							OR = {
    								character = event_target:great_minds_guest_1
    								character = event_target:great_minds_guest_2
    								character = event_target:great_minds_guest_3
    								character = event_target:great_minds_guest_4
    							}
    							society = {
    								any_society_member = {
    									OR = {
		    								character = event_target:great_minds_guest_1
		    								character = event_target:great_minds_guest_2
		    								character = event_target:great_minds_guest_3
		    								character = event_target:great_minds_guest_4
		    							}
		    							NOT = { opinion = { who = PREVPREV value = 10 } }
    								}
    							}
    						}
    					}
    				}
    				society = {
    					random_society_member = {
    						limit = {
    							OR = {
    								character = event_target:great_minds_guest_1
    								character = event_target:great_minds_guest_2
    								character = event_target:great_minds_guest_3
    								character = event_target:great_minds_guest_4
    							}
    							society = {
    								any_society_member = {
    									OR = {
		    								character = event_target:great_minds_guest_1
		    								character = event_target:great_minds_guest_2
		    								character = event_target:great_minds_guest_3
		    								character = event_target:great_minds_guest_4
		    							}
		    							NOT = { opinion = { who = PREVPREV value = 10 } }
    								}
    							}
    						}
    						save_event_target_as = arguer_2
    						society = {
	    						random_society_member = {
	    							limit = {
	    								OR = {
		    								character = event_target:great_minds_guest_1
		    								character = event_target:great_minds_guest_2
		    								character = event_target:great_minds_guest_3
		    								character = event_target:great_minds_guest_4
		    							}
		    							NOT = { opinion = { who = PREVPREV value = 10 } }
	    							}
	    							save_event_target_as = arguer_1
	    						}
    						}
    					}
    				}
    				character_event = { id = MNM.1471 days = 20 random = 10 }
    			}
    			35 = { #You agree with someone
    				trigger = {
    					OR = {
    						opinion = { who = event_target:great_minds_guest_1 value = 20 }
    						opinion = { who = event_target:great_minds_guest_2 value = 20 }
    						opinion = { who = event_target:great_minds_guest_3 value = 20 }
    						opinion = { who = event_target:great_minds_guest_4 value = 20 }
    					}
    				}
    				society = {
    					random_society_member = {
    						limit = {
    							OR = {
    								character = event_target:great_minds_guest_1
    								character = event_target:great_minds_guest_2
    								character = event_target:great_minds_guest_3
    								character = event_target:great_minds_guest_4
    							}
    							reverse_opinion = { who = ROOT value = 20 }
    						}
    						character_event = { id = MNM.1474 days = 20 random = 10 }
    					}
    				}
    			}
    			25 = { #You have a brilliant insight
    				trigger = { learning = 12 }
    				modifier = { learning = 14 factor = 1.2 }
    				modifier = { learning = 16 factor = 1.2 }
    				modifier = { learning = 18 factor = 1.2 }
    				modifier = { has_character_modifier = divine_summoning_succeeded factor = 1.5 }
    				character_event = { id = MNM.1476 days = 20 random = 10 }
    			}
    		}
    	}
    }
}


#Two people are arguing
character_event = {
    id = MNM.1471
    desc = EVTDESC_MNM_1471
    picture = GFX_evt_quarrel
    border = GFX_event_normal_frame_war

    is_triggered_only = yes
    hide_from = yes

    trigger = { has_character_flag =  gathering_of_the_minds }

    #Try to meddle
    option = { 
        name = EVTOPTA_MNM_1471
        custom_tooltip = { text = EVTOPTA_MNM_1471_TT }

        random_list = {
        	50 = { #It works
        		modifier = { society_rank >= 3 factor = 1.2 }
        		modifier = { 
        			reverse_opinion = { who = event_target:arguer_1 value = 25 }
        			reverse_opinion = { who = event_target:arguer_2 value = 25 } 
        			factor = 1.4
        		}
        		modifier = { diplomacy = 12 factor = 1.2 }
        		modifier = { diplomacy = 14 factor = 1.2 }
        		modifier = { diplomacy = 16 factor = 1.2 }
        		custom_tooltip = { text = EVTOPTA_MNM_1471_SUCCESS_TT }
        		hidden_effect = { character_event = { id = MNM.1472 days = 5 } }
        	}
        	50 = { #It didn't work
        		modifier = { NOT = { diplomacy = 10 } factor = 1.2 }
        		modifier = { has_unpleasant_personality_trigger = yes factor = 1.3 }
        		custom_tooltip = { text = EVTOPTA_MNM_1471_FAIL_TT }
        		hidden_effect = { character_event = { id = MNM.1473 days = 5 } }
        	}
        }
    }

    #Person 1 goes
    option = {
        name = EVTOPTB_MNM_1471
        custom_tooltip = { text = EVTOPTB_MNM_1471_TT }

        hidden_effect = {
        	if = { 
        		limit = { event_target:arguer_1 = { character = event_target:great_minds_guest_1 } }
        		clear_event_target = event_target:great_minds_guest_1
        	}
        	if = { 
        		limit = { event_target:arguer_1 = { character = event_target:great_minds_guest_2 } }
        		clear_event_target = event_target:great_minds_guest_2
        	}
        	if = { 
        		limit = { event_target:arguer_1 = { character = event_target:great_minds_guest_3 } }
        		clear_event_target = event_target:great_minds_guest_3
        	}
        	if = { 
        		limit = { event_target:arguer_1 = { character = event_target:great_minds_guest_4 } }
        		clear_event_target = event_target:great_minds_guest_4
        	}

        	hidden_effect = { character_event = { id = MNM.1480 } } #Handles scandals


    		#After some time, end result
    		character_event = { id = MNM.1477 days = 30 random = 20 }
        }
    }
    
    #Person 2 goes
    option = {
        name = EVTOPTC_MNM_1471
        custom_tooltip = { text = EVTOPTC_MNM_1471_TT }

        hidden_effect = {
        	if = { 
        		limit = { event_target:arguer_2 = { character = event_target:great_minds_guest_1 } }
        		clear_event_target = event_target:great_minds_guest_1
        	}
        	if = { 
        		limit = { event_target:arguer_2 = { character = event_target:great_minds_guest_2 } }
        		clear_event_target = event_target:great_minds_guest_2
        	}
        	if = { 
        		limit = { event_target:arguer_2 = { character = event_target:great_minds_guest_3 } }
        		clear_event_target = event_target:great_minds_guest_3
        	}
        	if = { 
        		limit = { event_target:arguer_2 = { character = event_target:great_minds_guest_4 } }
        		clear_event_target = event_target:great_minds_guest_4
        	}

        	hidden_effect = { character_event = { id = MNM.1480 } } #Handles scandals

    		#After some time, end result
    		character_event = { id = MNM.1477 days = 30 random = 20 }
        }
    }
}

#You managed to make the quarrelers make up
character_event = {
    id = MNM.1472
    desc = EVTDESC_MNM_1472
    picture = GFX_evt_state_diplomacy
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

    trigger = { has_character_flag =  gathering_of_the_minds }

    option = { 
        name = EVTOPTA_MNM_1472
        custom_tooltip = { text = EVTOPTA_MNM_1472_TT }

        reverse_opinion = {
        	who =  event_target:arguer_1
        	modifier = opinion_reasonable
        	years = 5
        }

        reverse_opinion = {
        	who =  event_target:arguer_2
        	modifier = opinion_reasonable
        	years = 5
        }


    	hidden_effect = {
    		#After some time, end result
    		character_event = { id = MNM.1477 days = 30 random = 20 }
    	}
    }
}

#You fail to make the quarrelers make up
character_event = {
    id = MNM.1473
    desc = EVTDESC_MNM_1473
    picture = GFX_evt_rival_rulers
    border = GFX_event_normal_frame_war

    is_triggered_only = yes

    trigger = { has_character_flag =  gathering_of_the_minds }

    option = { 
        name = EVTOPTA_MNM_1473
        custom_tooltip = { text = EVTOPTA_MNM_1473_TT }

        reverse_opinion = {
        	who =  event_target:arguer_1
        	modifier = opinion_unreasonable
        	years = 5
        }

        reverse_opinion = {
        	who =  event_target:arguer_2
        	modifier = opinion_unreasonable
        	years = 5
        }

        hidden_effect = {
        	#No one leaves because it is sure to end here

        	clr_character_flag = hermetics_minor_scandal
        	set_character_flag = hermetics_major_scandal
        	hidden_effect = { character_event = { id = MNM.1480 } } #Handles scandals

    		#After some time, end result
    		character_event = { id = MNM.1477 days = 30 random = 20 }
        }
    }
}

#You agree with someone (ping)
character_event = {
    id = MNM.1474
    hide_window = yes
    is_triggered_only = yes
    immediate = { FROM = { character_event = { id = MNM.1475 } } }
}

#You agree with someone, you work well together
character_event = {
    id = MNM.1475
    desc = EVTDESC_MNM_1475
    picture = GFX_evt_experiment
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

    trigger = { has_character_flag = gathering_of_the_minds }
    
    option = { 
        name = EVTOPTA_MNM_1475

        hidden_effect = {
        	#After some time, end result
    		character_event = { id = MNM.1477 days = 30 random = 20 }
        }

        if = {
        	limit = {
        		opinion = { who = FROM value = 40 }
        		reverse_opinion = { who = FROM value = 40 }
        		NOT = { is_friend = FROM }
        	}
        	add_friend = FROM
        	break = yes
        }
        reverse_opinion = {
        	who = FROM
        	modifier = opinion_great_minds
        	years = 10 
        }
        hidden_effect = {
        	opinion = {
	        	who = FROM
	        	modifier = opinion_great_minds
	        	years = 10 
	        }
        }
    }
}

#You have a brilliant insight		
character_event = {
    id = MNM.1476
    desc = EVTDESC_MNM_1476
    picture = GFX_evt_religious_exultation
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

    hide_from = yes

    trigger = { has_character_flag =  gathering_of_the_minds }

    option = { 
        name = EVTOPTA_MNM_1476
        custom_tooltip = { text = EVTOPTA_MNM_1476_TT }

        add_character_modifier = {
        	name = brilliant_insight
        	years = 5
        }

        set_character_flag = brilliant_insight


    	hidden_effect = {
    		#After some time, end result
    		character_event = { id = MNM.1477 days = 30 random = 20 }
    	}
    }
}

#Event to calculate outcome
character_event = {
    id = MNM.1477
    hide_window = yes
    is_triggered_only = yes
    trigger = { has_character_flag =  gathering_of_the_minds }
    immediate = {
    	#Adds up everyone's learning
    	set_variable = { which = collective_learning value = 0 }
    	if = {
    		limit = { event_target:great_minds_guest_1 = { always = yes } }
    		export_to_variable = { which = collective_learning_temp value = learning who = event_target:great_minds_guest_1 }
    		change_variable = { which = collective_learning which = collective_learning_temp }
    	}
    	if = {
    		limit = { event_target:great_minds_guest_2 = { always = yes } }
    		export_to_variable = { which = collective_learning_temp value = learning who = event_target:great_minds_guest_2 }
    		change_variable = { which = collective_learning which = collective_learning_temp }
    	}
    	if = {
    		limit = { event_target:great_minds_guest_3 = { always = yes } }
    		export_to_variable = { which = collective_learning_temp value = learning who = event_target:great_minds_guest_3 }
    		change_variable = { which = collective_learning which = collective_learning_temp }
    	}
    	if = {
    		limit = { event_target:great_minds_guest_4 = { always = yes } }
    		export_to_variable = { which = collective_learning_temp value = learning who = event_target:great_minds_guest_4 }
    		change_variable = { which = collective_learning which = collective_learning_temp }
    	}


    	#Outcome
    	random_list = {
    		20 = { #Best
    			trigger = { has_character_flag = risky_invention }
    			modifier = { learning = 10 factor = 1.3 }
    			modifier = { learning = 12 factor = 1.3 }
    			modifier = { learning = 14 factor = 1.3 }
    			modifier = { learning = 16 factor = 1.3 }
    			modifier = { learning = 18 factor = 1.3 }
    			modifier = { learning = 20 factor = 1.3 }
    			modifier = { has_character_flag = brilliant_insight factor = 100 }
    			modifier = { check_variable = { which = collective_learning value = 40 } factor = 1.4 }
    			modifier = { check_variable = { which = collective_learning value = 50 } factor = 1.4 }
    			modifier = { check_variable = { which = collective_learning value = 60 } factor = 1.4 }
    			set_character_flag = best_outcome
    			character_event = { id = MNM.1478 }
    		}
    		30 = { #Good
    			modifier = { learning = 10 factor = 1.2 }
    			modifier = { learning = 12 factor = 1.2 }
    			modifier = { learning = 14 factor = 1.2 }
    			modifier = { learning = 16 factor = 1.2 }
    			modifier = { learning = 18 factor = 1.2 }
    			modifier = { learning = 20 factor = 1.2 }
    			modifier = { has_character_flag = brilliant_insight factor = 10 }
    			modifier = { check_variable = { which = collective_learning value = 40 } factor = 1.3 }
    			modifier = { check_variable = { which = collective_learning value = 50 } factor = 1.3 }
    			modifier = { check_variable = { which = collective_learning value = 60 } factor = 1.3 }
    			set_character_flag = good_outcome
    			character_event = { id = MNM.1478 }
    		}
    		45 = { #Ok
    			trigger = { has_character_flag = safe_invention }
    			modifier = { learning = 10 factor = 1.1 }
    			modifier = { learning = 12 factor = 1.1 }
    			modifier = { learning = 14 factor = 1.1 }
    			modifier = { learning = 16 factor = 1.1 }
    			modifier = { learning = 18 factor = 1.1 }
    			modifier = { learning = 20 factor = 1.1 }
    			modifier = { check_variable = { which = collective_learning value = 40 } factor = 1.2 }
    			modifier = { check_variable = { which = collective_learning value = 50 } factor = 1.2 }
    			modifier = { check_variable = { which = collective_learning value = 60 } factor = 1.2 }
    			set_character_flag = ok_outcome
    			character_event = { id = MNM.1478 }
    		}
    		25 = { #Normal failure outcome 
    			trigger = { has_character_flag = safe_invention }
    			set_character_flag = failure_outcome
    			character_event = { id = MNM.1479 }
    		}
    		25 = { #Dangerous failure outcome
    			trigger = { has_character_flag = risky_invention }
    			set_character_flag = bad_failure_outcome
    			character_event = { id = MNM.1479 }
    		}
    	}
    	clr_character_flag = brilliant_insight
    }
}

#Good outcome
character_event = {
    id = MNM.1478
    picture = GFX_evt_gathering_of_minds
    border = GFX_event_normal_frame_religion

    desc = {
    	trigger = {
    		has_character_flag = best_outcome
    		has_character_flag = war_invention
    	}
    	text = EVTDESC_MNM_1478_A #Hand gun
    	picture = GFX_evt_gathering_of_minds
    }
    desc = {
    	trigger = {
    		has_character_flag = best_outcome 
    		has_character_flag = prosperity_invention
    	}
    	text = EVTDESC_MNM_1478_B #Compass
    	picture = GFX_evt_gathering_of_minds
    }
    desc = {
    	trigger = {
    		has_character_flag = best_outcome 
    		has_character_flag = knowledge_invention
    	}
    	text = EVTDESC_MNM_1478_C #Radius astronomicus
    	picture = GFX_evt_gathering_of_minds
    }
    desc = {
    	trigger = {
    		has_character_flag = good_outcome
    		has_character_flag = war_invention 
    	}
    	text = EVTDESC_MNM_1478_D #Giant crossbow
    	picture = GFX_evt_gathering_of_minds
    }
    desc = {
    	trigger = {
    		has_character_flag = good_outcome 
    		has_character_flag = prosperity_invention
    	}
    	text = EVTDESC_MNM_1478_E #Blast furnace
    	picture = GFX_evt_weaponsmith
    }
    desc = {
    	trigger = {
    		has_character_flag = good_outcome 
    		has_character_flag = knowledge_invention
    	}
    	text = EVTDESC_MNM_1478_F #Crypt and cypher machine
    	picture = GFX_evt_ritual_scroll
    }
    desc = {
    	trigger = {
    		has_character_flag = ok_outcome
    		has_character_flag = war_invention
    	}
    	text = EVTDESC_MNM_1478_G  #Plate armor
    	picture = GFX_evt_weaponsmith
    }
    desc = {
    	trigger = {
    		has_character_flag = ok_outcome 
    		has_character_flag = prosperity_invention
    	}
    	text = EVTDESC_MNM_1478_H #A new mill
    	picture = GFX_evt_gathering_of_minds
    }
    desc = {
    	trigger = {
    		has_character_flag = ok_outcome
    		has_character_flag = knowledge_invention
    	}
    	text = EVTDESC_MNM_1478_I #Glasses
    	picture = GFX_evt_gathering_of_minds
    }

    is_triggered_only = yes
    hide_from = yes
    
   	trigger = { has_character_flag =  gathering_of_the_minds }

    option = { 
    	trigger = {
    		has_character_flag = best_outcome
    		has_character_flag = war_invention
    	}
        name = EVTOPTA_MNM_1478

        add_artifact = hermetic_handgun

        military_techpoints = 100
        add_society_currency_major_effect = yes
    }

    option = {
    	trigger = {
    		has_character_flag = best_outcome
    		has_character_flag = prosperity_invention
    	}
        name = EVTOPTB_MNM_1478

       	add_artifact = hermetic_compass

        economy_techpoints = 100
        add_society_currency_major_effect = yes
    }
    
    option = {
    	trigger = {
    		has_character_flag = best_outcome
    		has_character_flag = knowledge_invention
    	}
        name = EVTOPTC_MNM_1478

        add_artifact = radius_astronomicus

        culture_techpoints = 100
        add_society_currency_major_effect = yes
    }
    
    option = {
    	trigger = {
    		has_character_flag = good_outcome
    		has_character_flag = war_invention
    	}
        name = EVTOPTD_MNM_1478

    	capital_scope = {
        	add_province_modifier = {
        		name = giant_crossbow
        		years = 100
        	}
        }

        military_techpoints = 50
      	add_society_currency_medium_effect = yes
    }

    option = {
    	trigger = {
    		has_character_flag = good_outcome
    		has_character_flag = prosperity_invention
    	}
        name = EVTOPTE_MNM_1478

        capital_scope = {
        	add_province_modifier = {
        		name = blast_furnace
        		years = 100
        	}
        }

        economy_techpoints = 50
      	add_society_currency_medium_effect = yes
    }

    option = {
    	trigger = {
    		has_character_flag = good_outcome
    		has_character_flag = knowledge_invention
    	}
        name = EVTOPTF_MNM_1478

        add_artifact = hermetic_cypher_machine

        culture_techpoints = 50
      	add_society_currency_medium_effect = yes
    }

    option = {
    	trigger = {
    		has_character_flag = ok_outcome
    		has_character_flag = war_invention
    	}
        name = EVTOPTG_MNM_1478

    	add_artifact = hermetic_plate_armor

    	military_techpoints = 25
      	add_society_currency_minor_effect = yes
    }

    option = {
    	trigger = {
    		has_character_flag = ok_outcome
    		has_character_flag = prosperity_invention
    	}
        name = EVTOPTH_MNM_1478

        capital_scope = {
        	add_province_modifier = {
        		name = great_mill
        		years = 100
        	}
        }

        economy_techpoints = 25
      	add_society_currency_minor_effect = yes
    }

    option = {
    	trigger = {
    		has_character_flag = ok_outcome
    		has_character_flag = knowledge_invention
    	}
        name = EVTOPTI_MNM_1478

        add_artifact = hermetic_glasses

        culture_techpoints = 25
      	add_society_currency_minor_effect = yes
    }

    after = {
    	hidden_effect = {
    		clr_character_flag = gathering_of_the_minds
    		clr_character_flag = war_invention
    		clr_character_flag = prosperity_invention
    		clr_character_flag = knowledge_invention
    		clr_character_flag = great_outcome
    		clr_character_flag = good_outcome
    		clr_character_flag = ok_outcome
    	}
    }
}

#Failure
character_event = {
    id = MNM.1479
    picture = GFX_evt_burning_house
    border = GFX_event_normal_frame_religion

    desc = {
    	trigger = { has_character_flag = failure_outcome }
    	text = EVTDESC_MNM_1479_A
    	picture = GFX_evt_quarrel
    }
    desc = {
    	trigger = { has_character_flag = bad_failure_outcome }
    	text = EVTDESC_MNM_1479_B
    }

    immediate = {
    	random_list = {
			20 = { set_character_flag = invention_failure_maimed }
			20 = { set_character_flag = invention_failure_wounded }
			60 = { } #They're safe
    	}
    	event_target:great_minds_guest_1 = {
    		random_list = {
    			20 = { set_character_flag = invention_failure_death }
    			20 = { set_character_flag = invention_failure_maimed }
    			20 = { set_character_flag = invention_failure_wounded }
    			40 = { } #They're safe
    		}
    	}
    	event_target:great_minds_guest_2 = {
    		random_list = {
    			20 = { set_character_flag = invention_failure_death }
    			20 = { set_character_flag = invention_failure_maimed }
    			20 = { set_character_flag = invention_failure_wounded }
    			40 = { } #They're safe
    		}
    	}
    	event_target:great_minds_guest_3 = {
    		random_list = {
    			20 = { set_character_flag = invention_failure_death }
    			20 = { set_character_flag = invention_failure_maimed }
    			20 = { set_character_flag = invention_failure_wounded }
    			40 = { } #They're safe
    		}
    	}
    	event_target:great_minds_guest_4 = {
    		random_list = {
    			20 = { set_character_flag = invention_failure_death }
    			20 = { set_character_flag = invention_failure_maimed }
    			20 = { set_character_flag = invention_failure_wounded }
    			40 = { } #They're safe
    		}
    	}
    }

    is_triggered_only = yes

    hide_from = yes

    option = { 
    	trigger = { has_character_flag = failure_outcome }
        name = EVTOPTA_MNM_1479
        custom_tooltip = { text = EVTOPTA_MNM_1479_TT }
    }

    option = {
    	trigger = { has_character_flag = bad_failure_outcome }
        name = EVTOPTB_MNM_1479
        custom_tooltip = { text = EVTOPTB_MNM_1479_TT }

        trigger_switch = {
	        on_trigger = has_character_flag
	        invention_failure_maimed	= { add_maimed_trait_effect = yes }
	        invention_failure_wounded	= { add_trait_silently_wounded_effect = yes }
        }

        event_target:great_minds_guest_1 = {
        	trigger_switch = {
		        on_trigger = has_character_flag
		       	invention_failure_death 	= { death = { death_reason = death_accident } }
		        invention_failure_maimed	= { add_maimed_trait_effect = yes }
		        invention_failure_wounded	= { add_trait_silently_wounded_effect = yes }
	        }
        }
        event_target:great_minds_guest_2 = {
        	trigger_switch = {
		        on_trigger = has_character_flag
		       	invention_failure_death 	= { death = { death_reason = death_accident } }
		        invention_failure_maimed	= { add_maimed_trait_effect = yes }
		        invention_failure_wounded	= { add_trait_silently_wounded_effect = yes }
	        }
        }
        event_target:great_minds_guest_3 = {
        	trigger_switch = {
		        on_trigger = has_character_flag
		       	invention_failure_death 	= { death = { death_reason = death_accident } }
		        invention_failure_maimed	= { add_maimed_trait_effect = yes }
		        invention_failure_wounded	= { add_trait_silently_wounded_effect = yes }
	        }
        }
        event_target:great_minds_guest_4 = {
        	trigger_switch = {
		        on_trigger = has_character_flag
		       	invention_failure_death 	= { death = { death_reason = death_accident } }
		        invention_failure_maimed	= { add_maimed_trait_effect = yes }
		        invention_failure_wounded	= { add_trait_silently_wounded_effect = yes }
	        }
        }
    }

    after = {
    	hidden_effect = {
    		clr_character_flag = gathering_of_the_minds
    		clr_character_flag = war_invention
    		clr_character_flag = prosperity_invention
    		clr_character_flag = knowledge_invention
    		clr_character_flag = failure_outcome
    		clr_character_flag = bad_failure_outcome

    		clr_character_flag = invention_failure_maimed
    		clr_character_flag = invention_failure_wounded
    		event_target:great_minds_guest_1 = {
    			clr_character_flag = invention_failure_maimed
    			clr_character_flag = invention_failure_wounded
    		}
    		event_target:great_minds_guest_2 = {
    			clr_character_flag = invention_failure_maimed
    			clr_character_flag = invention_failure_wounded
    		}
    		event_target:great_minds_guest_3 = {
    			clr_character_flag = invention_failure_maimed
    			clr_character_flag = invention_failure_wounded
    		}
    		event_target:great_minds_guest_4 = {
    			clr_character_flag = invention_failure_maimed
    			clr_character_flag = invention_failure_wounded
    		}
    	}
    }
}

#Handles scandals, ends the event chain if things go to far
character_event = {
    id = MNM.1480
    hide_window = yes
    is_triggered_only = yes
    trigger = { has_character_flag =  gathering_of_the_minds }
    immediate = {
    	if = {
	    	limit = {
	    		NOR = {
	    			has_character_flag = hermetics_minor_scandal
	    			has_character_flag = hermetics_major_scandal
	    		}
	    	}
	    	set_character_flag = hermetics_minor_scandal
	    	break = yes
    	} 
    	if = {
    		limit = { has_character_flag = hermetics_minor_scandal }
    		clr_character_flag = hermetics_minor_scandal
    		set_character_flag = hermetics_major_scandal
    		break = yes
    	}

    	if = {
    		limit = { has_character_flag = hermetics_major_scandal }
    		clr_character_flag = hermetics_major_scandal

    		character_event	= { id = MNM.1481 }
    	}
    }
}

character_event = {
    id = MNM.1481
    desc = EVTDESC_MNM_1481
    picture = GFX_evt_scandal
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes
    hide_from = yes
    
    option = { 
        name = EVTOPTA_MNM_1481
        custom_tooltip = { text = EVTOPTA_MNM_1481_TT }

        hidden_effect = {
        	clr_character_flag = gathering_of_the_minds
        	clr_character_flag = war_invention
        	clr_character_flag = prosperity_invention
        	clr_character_flag = knowledge_invention
        	clr_character_flag = hermetics_minor_scandal
        	clr_character_flag = hermetics_major_scandal
        	clr_character_flag = risky_invention
        	clr_character_flag = safe_invention
        	clr_character_flag = brilliant_insight

        	event_target:great_minds_guest_1 = {
        		clr_character_flag = war_invetion
        		clr_character_flag = prosperity_invention
        		clr_character_flag = knowledge_invention
        	}
        	event_target:great_minds_guest_2 = {
        		clr_character_flag = war_invetion
        		clr_character_flag = prosperity_invention
        		clr_character_flag = knowledge_invention
        	}
        	event_target:great_minds_guest_3 = {
        		clr_character_flag = war_invetion
        		clr_character_flag = prosperity_invention
        		clr_character_flag = knowledge_invention
        	}
        	event_target:great_minds_guest_4 = {
        		clr_character_flag = war_invetion
        		clr_character_flag = prosperity_invention
        		clr_character_flag = knowledge_invention
        	}
        }
    }
}	


##Divine Summoning##

#Divine Summoning find target ping
character_event = {
	id = MNM.1620
	hide_window = yes
	
	is_triggered_only = yes
	
	only_playable = yes
	only_capable = yes
	prisoner = no
	is_in_society = yes
	
	trigger = {
		society_member_of = hermetics
		NOT = { is_inaccessible_trigger = yes }
	}
	
	weight_multiplier = {
		factor = 1
		modifier = {
			factor = 2.0
			society_rank >= 3
		}
		modifier = {
			factor = 0.5
			society_rank == 1
		}
		modifier = {
			factor = 3.0
			OR = {
				has_focus = focus_scholarship
				has_focus = focus_theology
			}
		}
		modifier = {
			factor = 3.0
			trait = genius
		}
		modifier = {
			factor = 3.0
			trait = mystic
		}
		modifier = {
			factor = 2.0
			trait = quick
		}
		modifier = {
			factor = 2.0
			trait = shrewd
		}
		modifier = {
			factor = 0.5
			trait = dull
		}
		modifier = {
			factor = 0.5
			trait = slow
		}
		modifier = {
			factor = 0.1
			trait = imbecile
		}
		modifier = {
			factor = 0.25
			has_character_flag = had_a_divine_summoning
		}
	}
	
	immediate = {
		# First look for someone at court
		society = {
			random_society_member = {
				limit = {
					ai = yes
					is_incapable = no
					prisoner = no
					NOT = { is_inaccessible_trigger = yes }
					NOT = { character = ROOT }
					in_command = no
					host = { character = ROOT }
				}
				character_event = { id = MNM.1621 }
				break = yes
			}
			
			# Then look for someone in the same realm
			random_society_member = {
				limit = {
					ai = yes
					is_incapable = no
					prisoner = no
					NOT = { is_inaccessible_trigger = yes }
					NOT = { character = ROOT }
					in_command = no
					same_realm = ROOT
				}
				character_event = { id = MNM.1621 }
				break = yes
			}
			
			# Then look abroad...
			random_society_member = {
				limit = {
					ai = yes
					is_incapable = no
					prisoner = no
					NOT = { is_inaccessible_trigger = yes }
					NOT = { character = ROOT }
					in_command = no
					is_within_diplo_range = ROOT
				}
				character_event = { id = MNM.1621 }
			}
		}
	}
}

# Bounce
character_event = {
	id = MNM.1621
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		FROM = { character_event = { id = MNM.1622 } }
	}
}

# Divine Summoning - Planning
character_event = {
	id = MNM.1622
	picture = GFX_evt_shadowy_cabal
	border = GFX_event_normal_frame_religion
	
	desc = {
		text = EVTDESC_MNM_1622
		trigger = {
			FROM = {
				NOT = { host = { character = ROOT } }
			}
		}
	}
	desc = {
		text = EVTDESC_MNM_1622_COURT
		trigger = {
			FROM = {
				host = { character = ROOT }
			}
		}
	}

	is_triggered_only = yes

	option = {
		name = EVTOPTA_MNM_1622 # Anything to grow closer to the Divine!
		ai_chance = {
			factor = 100
			modifier = {
				factor = 50
				trait = ambitious
			}
			modifier = {
				factor = 50
				trait = mystic
			}
			modifier = {
				factor = 0
				any_artifact = {
					has_artifact_flag = ingredient
				}
			}
		}
		
		set_character_flag = had_a_divine_summoning
		
		FROM = { character_event = { id = MNM.1623 tooltip = EVT_TT_1622 } }
	}

	option = {
		name = EVTOPTA_MNM_1622_use_ingredients # Send them these ingredients to aid in the ritual!
		tooltip_info = yes
        custom_tooltip = { text = ingredient_option_available_tt }

		ai_chance = {
			factor = 500
			modifier = {
				factor = 50
				trait = ambitious
			}
			modifier = {
				factor = 50
				trait = mystic
			}
		}

		custom_tooltip = {
			text = ingredients_are_sent_tt
			hidden_effect = { destroy_random_ingredients_effect = yes }
		}

		
		set_character_flag = had_a_divine_summoning
		set_character_flag = used_ingredients_for_summoning
		
		FROM = { character_event = { id = MNM.1623 } }

		trigger = {
			any_artifact = {
				has_artifact_flag = ingredient
			}
		}
	}

	option = {
		name = EVTOPTB_MNM_1622 # Even rituals carry danger
		ai_chance = {
			factor = 1
			modifier = {
				factor = 50
				trait = craven
			}
			modifier = {
				factor = 25
				trait = content
			}
		}
		
		detract_society_currency_minor_effect = yes
		reverse_opinion = { who = FROM modifier = opinion_coward years = 5 }
	}
}

# Bounce
character_event = {
	id = MNM.1623
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		destroy_random_ingredients_effect = yes
		FROM = { narrative_event = { id = MNM.1624 days = 15 random = 15  } }
	}
}

# Divine Summoning - The Ritual
narrative_event = {
	id = MNM.1624
	picture = GFX_evt_magic_ritual
	border = GFX_event_narrative_frame_religion
	
	title = EVTTITLE_MNM_1624
	
	desc = { text = EVTDESC_MNM_1624 }

	is_triggered_only = yes
	
	option = { # Ask it the secrets of Alchemy (stewardship)
		name = EVTOPTA_MNM_1624
		
		hidden_effect = {
			set_character_flag = divine_summoning_alchemy
			FROM = { character_event = { id = MNM.1625 } }
		}
	}

	option = { # Ask it the secrets of Astrology (diplomacy)
		name = EVTOPTB_MNM_1624
		
		hidden_effect = {
			set_character_flag = divine_summoning_astrology
			FROM = { character_event = { id = MNM.1625 } }
		}
	}

	option = { # Open your mind to the Divine (learning)
		name = EVTOPTC_MNM_1624
		
		hidden_effect = {
			set_character_flag = divine_summoning_open_mind
			FROM = { character_event = { id = MNM.1625 } }
		}
	}

	option = { # Ask it about how the Truth has been hidden (intrigue)
		name = EVTOPTD_MNM_1624
		
		hidden_effect = {
			set_character_flag = divine_summoning_hidden_truth
			FROM = { character_event = { id = MNM.1625 } }
		}
	}
}

# Bounce
character_event = {
	id = MNM.1625
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_alchemy
					learning = 25
				}
			}
			random_list = {
				15 = {
					FROM = { set_character_flag = divine_summoning_success }
				}
				25 = {
					FROM = { set_character_flag = divine_summoning_alchemy_good_bonus }
				}
				40 = {
					FROM = { set_character_flag = divine_summoning_alchemy_bonus }
				}
				15 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_alchemy_penalty }
				}
				5 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_alchemy_bad_penalty }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_alchemy
					learning = 20
					NOT = { learning = 25 }
				}
			}
			random_list = {
				10 = {
					FROM = { set_character_flag = divine_summoning_success }
				}
				20 = {
					FROM = { set_character_flag = divine_summoning_alchemy_good_bonus }
				}
				35 = {
					FROM = { set_character_flag = divine_summoning_alchemy_bonus }
				}
				20 = {
					FROM = { set_character_flag = divine_summoning_alchemy_penalty }
				}
				10 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_alchemy_bad_penalty }
				}
				5 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_failure }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_alchemy
					learning = 15
					NOT = { learning = 20 }
				}
			}
			random_list = {
				5 = {
					FROM = { set_character_flag = divine_summoning_success }
				}
				10 = {
					FROM = { set_character_flag = divine_summoning_alchemy_good_bonus }
				}
				20 = {
					FROM = { set_character_flag = divine_summoning_alchemy_bonus }
				}
				35 = {
					FROM = { set_character_flag = divine_summoning_alchemy_penalty }
				}
				20 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_alchemy_bad_penalty }
				}
				10 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_failure }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_alchemy
					NOT = { learning = 15 }
				}
			}
			random_list = {
				5 = {
					FROM = { set_character_flag = divine_summoning_alchemy_good_bonus }
				}
				15 = {
					FROM = { set_character_flag = divine_summoning_alchemy_bonus }
				}
				40 = {
					FROM = { set_character_flag = divine_summoning_alchemy_penalty }
				}
				25 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_alchemy_bad_penalty }
				}
				15 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_failure }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_astrology
					learning = 25
				}
			}
			random_list = {
				15 = {
					FROM = { set_character_flag = divine_summoning_success }
				}
				25 = {
					FROM = { set_character_flag = divine_summoning_astrology_good_bonus }
				}
				40 = {
					FROM = { set_character_flag = divine_summoning_astrology_bonus }
				}
				15 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_astrology_penalty }
				}
				5 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_astrology_bad_penalty }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_astrology
					learning = 20
					NOT = { learning = 25 }
				}
			}
			random_list = {
				10 = {
					FROM = { set_character_flag = divine_summoning_success }
				}
				20 = {
					FROM = { set_character_flag = divine_summoning_astrology_good_bonus }
				}
				35 = {
					FROM = { set_character_flag = divine_summoning_astrology_bonus }
				}
				20 = {
					FROM = { set_character_flag = divine_summoning_astrology_penalty }
				}
				10 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_astrology_bad_penalty }
				}
				5 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_failure }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_astrology
					learning = 15
					NOT = { learning = 20 }
				}
			}
			random_list = {
				5 = {
					FROM = { set_character_flag = divine_summoning_success }
				}
				10 = {
					FROM = { set_character_flag = divine_summoning_astrology_good_bonus }
				}
				20 = {
					FROM = { set_character_flag = divine_summoning_astrology_bonus }
				}
				35 = {
					FROM = { set_character_flag = divine_summoning_astrology_penalty }
				}
				20 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_astrology_bad_penalty }
				}
				10 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_failure }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_astrology
					NOT = { learning = 15 }
				}
			}
			random_list = {
				5 = {
					FROM = { set_character_flag = divine_summoning_astrology_good_bonus }
				}
				15 = {
					FROM = { set_character_flag = divine_summoning_astrology_bonus }
				}
				40 = {
					FROM = { set_character_flag = divine_summoning_astrology_penalty }
				}
				25 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_astrology_bad_penalty }
				}
				15 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_failure }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_open_mind
					learning = 25
				}
			}
			random_list = {
				15 = {
					FROM = { set_character_flag = divine_summoning_success }
				}
				25 = {
					FROM = { set_character_flag = divine_summoning_open_mind_good_bonus }
				}
				40 = {
					FROM = { set_character_flag = divine_summoning_open_mind_bonus }
				}
				15 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_open_mind_penalty }
				}
				5 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_open_mind_bad_penalty }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_open_mind
					learning = 20
					NOT = { learning = 25 }
				}
			}
			random_list = {
				10 = {
					FROM = { set_character_flag = divine_summoning_success }
				}
				20 = {
					FROM = { set_character_flag = divine_summoning_open_mind_good_bonus }
				}
				35 = {
					FROM = { set_character_flag = divine_summoning_open_mind_bonus }
				}
				20 = {
					FROM = { set_character_flag = divine_summoning_open_mind_penalty }
				}
				10 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_open_mind_bad_penalty }
				}
				5 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_failure }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_open_mind
					learning = 15
					NOT = { learning = 20 }
				}
			}
			random_list = {
				5 = {
					FROM = { set_character_flag = divine_summoning_success }
				}
				10 = {
					FROM = { set_character_flag = divine_summoning_open_mind_good_bonus }
				}
				20 = {
					FROM = { set_character_flag = divine_summoning_open_mind_bonus }
				}
				40 = {
					FROM = { set_character_flag = divine_summoning_open_mind_penalty }
				}
				20 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_open_mind_bad_penalty }
				}
				10 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_failure }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_open_mind
					NOT = { learning = 15 }
				}
			}
			random_list = {
				5 = {
					FROM = { set_character_flag = divine_summoning_open_mind_good_bonus }
				}
				15 = {
					FROM = { set_character_flag = divine_summoning_open_mind_bonus }
				}
				40 = {
					FROM = { set_character_flag = divine_summoning_open_mind_penalty }
				}
				25 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_open_mind_bad_penalty }
				}
				15 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_failure }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_hidden_truth
					learning = 25
				}
			}
			random_list = {
				15 = {
					FROM = { set_character_flag = divine_summoning_success }
				}
				25 = {
					FROM = { set_character_flag = divine_summoning_hidden_truth_good_bonus }
				}
				40 = {
					FROM = { set_character_flag = divine_summoning_hidden_truth_bonus }
				}
				15 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_hidden_truth_penalty }
				}
				5 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_hidden_truth_bad_penalty }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_hidden_truth
					learning = 20
					NOT = { learning = 25 }
				}
			}
			random_list = {
				10 = {
					FROM = { set_character_flag = divine_summoning_success }
				}
				20 = {
					FROM = { set_character_flag = divine_summoning_hidden_truth_good_bonus }
				}
				35 = {
					FROM = { set_character_flag = divine_summoning_hidden_truth_bonus }
				}
				20 = {
					FROM = { set_character_flag = divine_summoning_hidden_truth_penalty }
				}
				10 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_hidden_truth_bad_penalty }
				}
				5 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_failure }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_hidden_truth
					learning = 15
					NOT = { learning = 20 }
				}
			}
			random_list = {
				5 = {
					FROM = { set_character_flag = divine_summoning_success }
				}
				10 = {
					FROM = { set_character_flag = divine_summoning_hidden_truth_good_bonus }
				}
				20 = {
					FROM = { set_character_flag = divine_summoning_hidden_truth_bonus }
				}
				35 = {
					FROM = { set_character_flag = divine_summoning_hidden_truth_penalty }
				}
				20 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_hidden_truth_bad_penalty }
				}
				10 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_failure }
				}
			}
		}
		if = {
			limit = {
				FROM = {
					has_character_flag = divine_summoning_hidden_truth
					NOT = { learning = 15 }
				}
			}
			random_list = {
				5 = {
					FROM = { set_character_flag = divine_summoning_hidden_truth_good_bonus }
				}
				15 = {
					FROM = { set_character_flag = divine_summoning_hidden_truth_bonus }
				}
				40 = {
					FROM = { set_character_flag = divine_summoning_hidden_truth_penalty }
				}
				25 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_hidden_truth_bad_penalty }
				}
				15 = {
					modifier = {
						factor = 0.5
						FROM = { has_character_flag = used_ingredients_for_summoning }
					}
					FROM = { set_character_flag = divine_summoning_failure }
				}
			}
		}
		FROM = { character_event = { id = MNM.1626 days = 15 random = 15  } }
		FROM = { clr_character_flag = used_ingredients_for_summoning }
	}
}

# Divine Summoning - Result
character_event = {
	id = MNM.1626
	picture = GFX_evt_shadowy_cabal
	border = GFX_event_normal_frame_religion
	
	desc = {
		text = EVTDESC_MNM_1626_SUCCESS
		trigger = {
			has_character_flag = divine_summoning_success
		}
	}
	desc = {
		text = EVTDESC_MNM_1626_FAILURE
		trigger = {
			has_character_flag = divine_summoning_failure
		}
	}
	desc = {
		text = EVTDESC_MNM_1626_ALCH_BONUS
		trigger = {
			OR = {
				has_character_flag = divine_summoning_alchemy_good_bonus
				has_character_flag = divine_summoning_alchemy_bonus
				has_character_flag = divine_summoning_alchemy_penalty
				has_character_flag = divine_summoning_alchemy_bad_penalty
			}
		}
	}
	desc = {
		text = EVTDESC_MNM_1626_ASTR_BONUS
		trigger = {
			OR = {
				has_character_flag = divine_summoning_astrology_good_bonus
				has_character_flag = divine_summoning_astrology_bonus
				has_character_flag = divine_summoning_astrology_penalty
				has_character_flag = divine_summoning_astrology_bad_penalty
			}
		}
	}
	desc = {
		text = EVTDESC_MNM_1626_MIND_BONUS
		trigger = {				
			OR = {
				has_character_flag = divine_summoning_open_mind_good_bonus
				has_character_flag = divine_summoning_open_mind_bonus
				has_character_flag = divine_summoning_open_mind_penalty
				has_character_flag = divine_summoning_open_mind_bad_penalty
			}
		}
	}
	desc = {
		text = EVTDESC_MNM_1626_TRUTH_BONUS
		trigger = {
			OR = {
				has_character_flag = divine_summoning_hidden_truth_good_bonus
				has_character_flag = divine_summoning_hidden_truth_bonus
				has_character_flag = divine_summoning_hidden_truth_penalty
				has_character_flag = divine_summoning_hidden_truth_bad_penalty
			}
		}
	}

	is_triggered_only = yes

	option = {
		name = EVTOPTA_MNM_1626 # Success
		trigger = {
			NOT = {
				has_character_flag = divine_summoning_success
				has_character_flag = divine_summoning_failure
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_alchemy_good_bonus
			}
			add_character_modifier = {
				name = alchemy_good_ste_bonus
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_alchemy_bonus
			}
			add_character_modifier = {
				name = alchemy_ste_bonus
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_alchemy_penalty
			}
			add_character_modifier = {
				name = alchemy_ste_penalty
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_alchemy_bad_penalty
			}
			add_character_modifier = {
				name = alchemy_bad_ste_penalty
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_astrology_good_bonus
			}
			add_character_modifier = {
				name = astrology_good_dip_bonus
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_astrology_bonus
			}
			add_character_modifier = {
				name = astrology_dip_bonus
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_astrology_penalty
			}
			add_character_modifier = {
				name = astrology_dip_penalty
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_astrology_bad_penalty
			}
			add_character_modifier = {
				name = astrology_bad_dip_penalty
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_open_mind_good_bonus
			}
			add_character_modifier = {
				name = open_mind_good_lea_bonus
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_open_mind_bonus
			}
			add_character_modifier = {
				name = open_mind_lea_bonus
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_open_mind_penalty
			}
			add_character_modifier = {
				name = open_mind_lea_penalty
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_open_mind_bad_penalty
			}
			add_character_modifier = {
				name = open_mind_bad_lea_penalty
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_hidden_truth_good_bonus
			}
			add_character_modifier = {
				name = hidden_truth_good_int_bonus
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_hidden_truth_bonus
			}
			add_character_modifier = {
				name = hidden_truth_int_bonus
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_hidden_truth_penalty
			}
			add_character_modifier = {
				name = hidden_truth_int_penalty
				years = 5
			}
		}
		if = {
			limit = {
				has_character_flag = divine_summoning_hidden_truth_bad_penalty
			}
			add_character_modifier = {
				name = hidden_truth_bad_int_penalty
				years = 5
			}
		}
	}
	option = {
		name = EVTOPTB_MNM_1626 # Critical success
		trigger = {
			has_character_flag = divine_summoning_success
		}
		prestige = 100
		add_character_modifier = {
			name = divine_summoning_succeeded
			years = 10
		}
		add_society_currency_minor_effect = yes
	}
	option = {
		name = EVTOPTC_MNM_1626 # Failure
		trigger = {
			has_character_flag = divine_summoning_failure
		}
		prestige = -100
		add_character_modifier = {
			name = divine_summoning_failed
			years = 10
		}
	}
	after = {
		clr_character_flag = divine_summoning_success
		clr_character_flag = divine_summoning_failure
		clr_character_flag = divine_summoning_alchemy_good_bonus
		clr_character_flag = divine_summoning_alchemy_bonus
		clr_character_flag = divine_summoning_alchemy_penalty
		clr_character_flag = divine_summoning_alchemy_bad_penalty
		clr_character_flag = divine_summoning_astrology_good_bonus
		clr_character_flag = divine_summoning_astrology_bonus
		clr_character_flag = divine_summoning_astrology_penalty
		clr_character_flag = divine_summoning_astrology_bad_penalty
		clr_character_flag = divine_summoning_open_mind_good_bonus
		clr_character_flag = divine_summoning_open_mind_bonus
		clr_character_flag = divine_summoning_open_mind_penalty
		clr_character_flag = divine_summoning_open_mind_bad_penalty
		clr_character_flag = divine_summoning_hidden_truth_good_bonus
		clr_character_flag = divine_summoning_hidden_truth_bonus
		clr_character_flag = divine_summoning_hidden_truth_penalty
		clr_character_flag = divine_summoning_hidden_truth_bad_penalty
		clr_character_flag = divine_summoning_alchemy
		clr_character_flag = divine_summoning_astrology
		clr_character_flag = divine_summoning_open_mind
		clr_character_flag = divine_summoning_hidden_truth
	}
}

## Write a Theorem Paper

#Write a Theory Paper - choose approach
character_event = {
	id = MNM.1630
	desc = EVTDESC_MNM_1630
	picture = GFX_evt_scientist
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

    option = { #Normal effort
    	name = EVTOPTA_MNM_1630
    	custom_tooltip = { text = EVTOPTA_MNM_1630_TT }
    	hidden_effect = {
    		set_character_flag = theory_paper_normal_effort
    		character_event = { id = MNM.1631 days = 90 random = 90 }
    	}
    }
    option = { #Get help from others
    	name = EVTOPTB_MNM_1630
    	trigger = {
    		diplomacy = 15
    	}
    	tooltip_info = diplomacy
    	custom_tooltip = { text = EVTOPTB_MNM_1630_TT }
    	hidden_effect = {
    		set_character_flag = theory_paper_asked_help
    		character_event = { id = MNM.1631 days = 90 random = 90 }
    	}
    }
    option = { #Steal another's work
    	name = EVTOPTC_MNM_1630
    	trigger = {
    		intrigue = 15
    	}
    	tooltip_info = intrigue
	   	custom_tooltip = { text = EVTOPTC_MNM_1630_TT }
    	hidden_effect = {
    		set_character_flag = theory_paper_stole_work
    		character_event = { id = MNM.1631 days = 90 random = 90 }
    	}
    }
    option = { #Invest heavily in research
    	name = EVTOPTD_MNM_1630
    	trigger = {
    		NOT = { trait = content }
    	}
    	if = {
    		limit = {
    			NOT = {
    				trait = ambitious
    				trait = content
    			}
    		}
    		random = {
    			chance = 10
    			add_trait = ambitious
    		}
    	}
    	if = {
    		limit = {
    			NOT = {
    				trait = stressed
    			}
    		}
    		random = {
    			chance = 10
    			add_trait = stressed
    		}
    	}
    	scaled_wealth = { value = -1 min = -25 }
    	piety = -50
    	add_character_modifier = {
    		name = theory_paper_heavy_investment
    		years = 1
    	}
    	custom_tooltip = { text = EVTOPTD_MNM_1630_TT }
    	hidden_effect = {
    		set_character_flag = theory_paper_heavy_investment
    		character_event = { id = MNM.1631 days = 180 random = 180 }
    	}
    }
}

#Ping event for deciding success
character_event = {
	id = MNM.1631
	hide_window = yes

	is_triggered_only = yes

	trigger = { is_alive = yes }

	immediate = {
		random_list = {
			15 = {
				modifier = {
					factor = 2
					learning = 25
				}
				modifier = {
					factor = 2
					has_character_flag = theory_paper_heavy_investment
				}
				modifier = {
					factor = 1.4
					has_character_flag = theory_paper_asked_help
				}
				modifier = {
					factor = 1.6
					has_character_flag = theory_paper_stole_work
				}
				modifier = {
					factor = 2
					trait = genius
				}
				modifier = {
					factor = 0.5
					trait = imbecile
				}
				modifier = {
					factor = 1.6
					trait = quick
				}
				modifier = {
					factor = 0.7
					trait = slow
				}
				modifier = {
					factor = 0.6
					trait = inbred
				}
				modifier = {
					factor = 1.4
					trait = shrewd
				}
				modifier = {
					factor = 0.8
					trait = dull
				}
				modifier = {
					factor = 1.3
					trait = mastermind_theologian
				}
				modifier = {
					factor = 1.4
					trait = scholar
				}
				modifier = {
					factor = 1.4
					trait = mystic
				}
				modifier = {
					factor = 1.4
					trait = theologian
				}
				modifier = {
					factor = 1.6
					trait = diligent
				}
				modifier = {
					factor = 0.7
					trait = slothful
				}
				modifier = {
					factor = 1.6
					trait = ambitious
				}
				modifier = {
					factor = 0.7
					trait = content
				}
				modifier = {
					factor = 1.6
					trait = erudite
				}
				set_character_flag = theory_paper_revolutionary
			}
			25 = {
				modifier = {
					factor = 2
					AND = {
						learning = 17
						NOT = { learning = 25 }
					}
				}
				modifier = {
					factor = 2
					has_character_flag = theory_paper_heavy_investment
				}
				modifier = {
					factor = 1.3
					has_character_flag = theory_paper_asked_help
				}
				modifier = {
					factor = 1.6
					has_character_flag = theory_paper_stole_work
				}
				modifier = {
					factor = 2
					trait = genius
				}
				modifier = {
					factor = 0.5
					trait = imbecile
				}
				modifier = {
					factor = 1.6
					trait = quick
				}
				modifier = {
					factor = 0.7
					trait = slow
				}
				modifier = {
					factor = 0.6
					trait = inbred
				}
				modifier = {
					factor = 1.4
					trait = shrewd
				}
				modifier = {
					factor = 0.8
					trait = dull
				}
				modifier = {
					factor = 1.3
					trait = scholarly_theologian
				}
				modifier = {
					factor = 1.4
					trait = scholar
				}
				modifier = {
					factor = 1.4
					trait = mystic
				}
				modifier = {
					factor = 1.4
					trait = theologian
				}
				modifier = {
					factor = 1.6
					trait = diligent
				}
				modifier = {
					factor = 0.7
					trait = slothful
				}
				modifier = {
					factor = 1.6
					trait = ambitious
				}
				modifier = {
					factor = 0.7
					trait = content
				}
				modifier = {
					factor = 1.6
					trait = erudite
				}
				set_character_flag = theory_paper_excellent
			}
			35 = {
				modifier = {
					factor = 2
					AND = {
						learning = 9
						NOT = { learning = 17 }
					}
				}
				modifier = {
					factor = 1.3
					trait = martial_cleric
				}
				set_character_flag = theory_paper_average
			}
			25 = {
				modifier = {
					factor = 2
					NOT = { learning = 9 }
				}
				modifier = {
					factor = 0.5
					has_character_flag = theory_paper_heavy_investment
				}
				modifier = {
					factor = 0.8
					has_character_flag = theory_paper_asked_help
				}
				modifier = {
					factor = 0.7
					has_character_flag = theory_paper_stole_work
				}
				modifier = {
					factor = 0.5
					trait = genius
				}
				modifier = {
					factor = 2
					trait = imbecile
				}
				modifier = {
					factor = 2
					trait = lunatic
				}
				modifier = {
					factor = 0.7
					trait = quick
				}
				modifier = {
					factor = 1.6
					trait = slow
				}
				modifier = {
					factor = 1.8
					trait = inbred
				}
				modifier = {
					factor = 0.8
					trait = shrewd
				}
				modifier = {
					factor = 1.4
					trait = dull
				}
				modifier = {
					factor = 1.3
					trait = detached_priest
				}
				modifier = {
					factor = 0.8
					trait = scholar
				}
				modifier = {
					factor = 0.8
					trait = mystic
				}
				modifier = {
					factor = 0.8
					trait = theologian
				}
				modifier = {
					factor = 0.7
					trait = diligent
				}
				modifier = {
					factor = 1.6
					trait = slothful
				}
				modifier = {
					factor = 0.7
					trait = ambitious
				}
				modifier = {
					factor = 1.6
					trait = content
				}
				modifier = {
					factor = 0.7
					trait = erudite
				}
				set_character_flag = theory_paper_simplistic
			}
		}
		remove_character_modifier = theory_paper_heavy_investment
		character_event = { id = MNM.1640 }
	}
}

#Write a Theory Paper - Finished Paper
character_event = {
	id = MNM.1640
	desc = {
		text = EVTDESCA_MNM_1640_RITUALS
		trigger = {
			has_character_flag = MNM_1640_rituals
		}
	}
	desc = {
		text = EVTDESCA_MNM_1640_ASCENSION
		trigger = {
			has_character_flag = MNM_1640_ascension
		}
	}
	desc = {
		text = EVTDESCA_MNM_1640_MIND_OF_GOD
		trigger = {
			has_character_flag = MNM_1640_mind_of_god
		}
	}
	desc = {
		text = EVTDESCA_MNM_1640_TRANSLATING_HIEROGLYPHICS
		trigger = {
			has_character_flag = MNM_1640_translating_hieroglyphics
		}
	}
	desc = {
		text = EVTDESCA_MNM_1640_DISTILLATION
		trigger = {
			has_character_flag = MNM_1640_distillation
		}
	}
	desc = {
		text = EVTDESCA_MNM_1640_FERMENTATION
		trigger = {
			has_character_flag = MNM_1640_fermentation
		}
	}
	desc = {
		text = EVTDESCA_MNM_1640_ELIXIR_OF_LIFE
		trigger = {
			has_character_flag = MNM_1640_elixir_of_life
		}
	}
	desc = {
		text = EVTDESCA_MNM_1640_PILOSOPHERS_STONE
		trigger = {
			has_character_flag = MNM_1640_philosophers_stone
		}
	}
	desc = {
		text = EVTDESCA_MNM_1640_PLANETS
		trigger = {
			has_character_flag = MNM_1640_planets
		}
	}
	desc = {
		text = EVTDESCA_MNM_1640_STARS
		trigger = {
			has_character_flag = MNM_1640_stars
		}
	}
	desc = {
		text = EVTDESCA_MNM_1640_MOON
		trigger = {
			has_character_flag = MNM_1640_moon
		}
	}
	desc = {
		text = EVTDESCA_MNM_1640_SUN
		trigger = {
			has_character_flag = MNM_1640_sun
		}
	}
	picture = GFX_evt_scientist
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		random_list = {
			10 = {
				set_character_flag = MNM_1640_rituals
				modifier = {
					factor = 3
					trait = theologian
				}
			}
			10 = {
				set_character_flag = MNM_1640_ascension
				modifier = {
					factor = 3
					trait = theologian
				}
			}
			10 = {
				set_character_flag = MNM_1640_mind_of_god
				modifier = {
					factor = 3
					trait = theologian
				}
			}
			10 = {
				set_character_flag = MNM_1640_translating_hieroglyphics
				modifier = {
					factor = 3
					trait = scholar
				}
				modifier = {
					factor = 2
					trait = erudite
				}
			}
			10 = {
				set_character_flag = MNM_1640_distillation
				modifier = {
					factor = 3
					trait = mystic
				}
				modifier = {
					factor = 2
					trait = erudite
				}
			}
			10 = {
				set_character_flag = MNM_1640_fermentation
				modifier = {
					factor = 3
					trait = mystic
				}
				modifier = {
					factor = 2
					trait = erudite
				}
			}
			10 = {
				set_character_flag = MNM_1640_elixir_of_life
				modifier = {
					factor = 3
					trait = mystic
				}
			}
			10 = {
				set_character_flag = MNM_1640_philosophers_stone
				modifier = {
					factor = 3
					trait = mystic
				}
			}
			10 = {
				set_character_flag = MNM_1640_planets
				modifier = {
					factor = 3
					trait = scholar
				}
				modifier = {
					factor = 3
					trait = diligent
				}
			}
			10 = {
				set_character_flag = MNM_1640_stars
				modifier = {
					factor = 3
					trait = scholar
				}
			}
			10 = {
				set_character_flag = MNM_1640_moon
				modifier = {
					factor = 3
					trait = scholar
				}
			}
			10 = {
				set_character_flag = MNM_1640_sun
				modifier = {
					factor = 3
					trait = scholar
				}
			}
		}
		set_variable = {
			which = peer_review
			value = 0
		}
		
		society = {
			random_society_member = {
				limit = {
					NOT = { character = ROOT }
					is_within_diplo_range = ROOT
					NOT = { is_inaccessible_trigger = yes }
				}
				save_event_target_as = peer1
				set_character_flag = peer_review_temp
			}
			random_society_member = {
				limit = {
					NOT = { character = ROOT }
					is_within_diplo_range = ROOT
					NOT = { is_inaccessible_trigger = yes }
					NOT = { has_character_flag = peer_review_temp }
				}
				save_event_target_as = peer2
				set_character_flag = peer_review_temp
			}
			random_society_member = {
				limit = {
					NOT = { character = ROOT }
					is_within_diplo_range = ROOT
					NOT = { is_inaccessible_trigger = yes }
					NOT = { has_character_flag = peer_review_temp }
				}
				save_event_target_as = peer3
				set_character_flag = peer_review_temp
			}
			random_society_member = {
				limit = {
					NOT = { character = ROOT }
					is_within_diplo_range = ROOT
					NOT = { is_inaccessible_trigger = yes }
					NOT = { has_character_flag = peer_review_temp }
				}
				save_event_target_as = peer4
				set_character_flag = peer_review_temp
			}
			random_society_member = {
				limit = {
					NOT = { character = ROOT }
					is_within_diplo_range = ROOT
					NOT = { is_inaccessible_trigger = yes }
					NOT = { has_character_flag = peer_review_temp }
				}
				save_event_target_as = peer5
				set_character_flag = peer_review_temp
			}
			event_target:peer1 = { clr_character_flag = peer_review_temp }
			event_target:peer2 = { clr_character_flag = peer_review_temp }
			event_target:peer3 = { clr_character_flag = peer_review_temp }
			event_target:peer4 = { clr_character_flag = peer_review_temp }
			event_target:peer5 = { clr_character_flag = peer_review_temp }
		}
	}
	
	option = { #send it out for review!
		name = EVTOPTA_MNM_1640
		
		event_target:peer1 = { 
			character_event = { id = MNM.1641 days = 15 } 
			set_character_flag = show_tooltip
			clr_character_flag = show_tooltip
		}
		event_target:peer2 = { 
			character_event = { id = MNM.1641 days = 18 } 
			set_character_flag = show_tooltip
			clr_character_flag = show_tooltip
		}
		event_target:peer3 = { 
			character_event = { id = MNM.1641 days = 21 } 
			set_character_flag = show_tooltip
			clr_character_flag = show_tooltip
		}
		event_target:peer4 = { 
			character_event = { id = MNM.1641 days = 24 } 
			set_character_flag = show_tooltip
			clr_character_flag = show_tooltip
		}
		event_target:peer5 = { 
			character_event = { id = MNM.1641 days = 27 } 
			set_character_flag = show_tooltip
			clr_character_flag = show_tooltip
		}
		
		custom_tooltip = {
			text = EVTTOOLTIPA_MNM_1640
			hidden_effect = {
				set_variable = {
					which = peer_review_score
					value = 0
				}
				character_event = { id = MNM.1644 days = 100 }
			}
		}
	}
	
	option = { #No, this shall never see the light of day!
		name = EVTOPTB_MNM_1640

		custom_tooltip = {
			text = EVTTOOLTIPB_MNM_1640
			hidden_effect = {
				clr_character_flag = theory_paper_normal_effort
				clr_character_flag = theory_paper_asked_help
				clr_character_flag = theory_paper_stole_work
				clr_character_flag = theory_paper_heavy_investment
				clr_character_flag = theory_paper_revolutionary
				clr_character_flag = theory_paper_excellent
				clr_character_flag = theory_paper_average
				clr_character_flag = theory_paper_simplistic
			}
		}
	}
	
	after = {
		clr_character_flag = MNM_1640_rituals
		clr_character_flag = MNM_1640_ascension
		clr_character_flag = MNM_1640_mind_of_god
		clr_character_flag = MNM_1640_translating_hieroglyphics
		clr_character_flag = MNM_1640_distillation
		clr_character_flag = MNM_1640_fermentation
		clr_character_flag = MNM_1640_elixir_of_life
		clr_character_flag = MNM_1640_philosophers_stone
		clr_character_flag = MNM_1640_planets
		clr_character_flag = MNM_1640_stars
		clr_character_flag = MNM_1640_moon
		clr_character_flag = MNM_1640_sun
	}
}

#Theory Paper - Peer Reviewer's event
character_event = {
	id = MNM.1641
	desc = {
		text = EVTDESCA_MNM_1641_RITUALS
		trigger = {
			FROM = { has_character_flag = MNM_1640_rituals }
		}
	}
	desc = {
		text = EVTDESCA_MNM_1641_ASCENSION
		trigger = {
			FROM = { has_character_flag = MNM_1640_ascension }
		}
	}
	desc = {
		text = EVTDESCA_MNM_1641_MIND_OF_GOD
		trigger = {
			FROM = { has_character_flag = MNM_1640_mind_of_god }
		}
	}
	desc = {
		text = EVTDESCA_MNM_1641_TRANSLATING_HIEROGLYPHICS
		trigger = {
			FROM = { has_character_flag = MNM_1640_translating_hieroglyphics }
		}
	}
	desc = {
		text = EVTDESCA_MNM_1641_DISTILLATION
		trigger = {
			FROM = { has_character_flag = MNM_1640_distillation }
		}
	}
	desc = {
		text = EVTDESCA_MNM_1641_FERMENTATION
		trigger = {
			FROM = { has_character_flag = MNM_1640_fermentation }
		}
	}
	desc = {
		text = EVTDESCA_MNM_1641_ELIXIR_OF_LIFE
		trigger = {
			FROM = { has_character_flag = MNM_1640_elixir_of_life }
		}
	}
	desc = {
		text = EVTDESCA_MNM_1641_PILOSOPHERS_STONE
		trigger = {
			FROM = { has_character_flag = MNM_1640_philosophers_stone }
		}
	}
	desc = {
		text = EVTDESCA_MNM_1641_PLANETS
		trigger = {
			FROM = { has_character_flag = MNM_1640_planets }
		}
	}
	desc = {
		text = EVTDESCA_MNM_1641_STARS
		trigger = {
			FROM = { has_character_flag = MNM_1640_stars }
		}
	}
	desc = {
		text = EVTDESCA_MNM_1641_MOON
		trigger = {
			FROM = { has_character_flag = MNM_1640_moon }
		}
	}
	desc = {
		text = EVTDESCA_MNM_1641_SUN
		trigger = {
			FROM = { has_character_flag = MNM_1640_sun }
		}
	}
	picture = GFX_evt_gathering_of_minds
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		if = {
			limit = {
				FROM = { has_character_flag = theory_paper_stole_work }
			}
			random_list = {
				10 = { # Discovered knowledge theft
					modifier = {
						factor = 1.3
						intrigue = 2
						learning = 2
					}
					modifier = {
						factor = 1.3
						intrigue = 4
						learning = 4
					}
					modifier = {
						factor = 1.3
						intrigue = 6
						learning = 6
					}
					modifier = {
						factor = 1.3
						intrigue = 8
						learning = 8
					}
					modifier = {
						factor = 1.3
						intrigue = 10
						learning = 10
					}
					modifier = {
						factor = 1.3
						intrigue = 12
						learning = 12
					}
					modifier = {
						factor = 1.3
						intrigue = 14
						learning = 14
					}
					modifier = {
						factor = 1.3
						intrigue = 16
						learning = 16
					}
					modifier = {
						factor = 1.3
						intrigue = 18
						learning = 18
					}
					modifier = {
						factor = 1.3
						intrigue = 20
						learning = 20
					}
					
					set_character_flag = discovered_knowledge_theft
				}
				1000 = { #no discovery
					
				}
			}
		}
	}
	
	option = { # Endorse
		name = EVTOPTA_MNM_1641
		trigger = {
			NOT = { has_character_flag = discovered_knowledge_theft }
		}
		ai_chance = {
			factor = 70
			
			modifier = {
				factor = 1.3
				opinion = {
					who = ROOT
					value = 20
				}
			}
			modifier = {
				factor = 1.3
				opinion = {
					who = ROOT
					value = 40
				}
			}
			modifier = {
				factor = 1.3
				opinion = {
					who = ROOT
					value = 60
				}
			}
			modifier = {
				factor = 1.3
				opinion = {
					who = ROOT
					value = 80
				}
			}
			modifier = {
				factor = 0.5
				NOT = {
					opinion = {
						who = ROOT
						value = 1
					}
				}
			}
			modifier = {
				factor = 0.5
				NOT = {
					opinion = {
						who = ROOT
						value = -19
					}
				}
			}
			modifier = {
				factor = 0.5
				NOT = {
					opinion = {
						who = ROOT
						value = -39
					}
				}
			}
			
			modifier = {
				factor = 1.2
				FROM = {
					OR = {
						has_character_flag = theory_paper_average
						has_character_flag = theory_paper_excellent
						has_character_flag = theory_paper_revolutionary
					}
				}
				learning = 7
			}
			modifier = {
				factor = 1.2
				FROM = {
					OR = {
						has_character_flag = theory_paper_excellent
						has_character_flag = theory_paper_revolutionary
					}
				}
				learning = 10
			}
			modifier = {
				factor = 1.2
				FROM = {
					has_character_flag = theory_paper_revolutionary
				}
				learning = 13
			}
			modifier = {
				factor = 0.6
				FROM = {
					has_character_flag = theory_paper_simplistic
				}
				learning = 7
			}
			modifier = {
				factor = 2
				FROM = {
					has_character_flag = theory_paper_simplistic
				}
				NOT = { learning = 7 }
			}
		}
		
		custom_tooltip = {
			text = EVTTOOLTIPA_MNM_1641
			hidden_effect = {
				FROM = {
					change_variable = {
						which = peer_review_score
						value = 1
					}
					letter_event = { id = MNM.1642 }
				}
			}
		}
	}
	
	option = { # Refute
		name = EVTOPTB_MNM_1641
		trigger = {
			NOT = { has_character_flag = discovered_knowledge_theft }
		}
		ai_chance = {
			factor = 30
		}
		
		custom_tooltip = {
			text = EVTTOOLTIPB_MNM_1641
			hidden_effect = {
				set_character_flag = refuted_paper_@FROM
				FROM = {
					letter_event = { id = MNM.1643 }
				}
			}
		}
		
		tooltip = {
			opinion = {
				who = FROM
				modifier = opinion_academic_failure
				years = 15
			}
			reverse_opinion = {
				who = FROM
				modifier = opinion_academic_grudge
				years = 15
			}
		}
	}
	
	option = { # Discovered plagiarism
		name = EVTOPTC_MNM_1641
		trigger = {
			has_character_flag = discovered_knowledge_theft
		}
		add_society_currency_minor_effect = yes
		prestige = 125
		custom_tooltip = {
			text = EVTTOOLTIPC_MNM_1641
			hidden_effect = {
				FROM = {
					character_event = { id = MNM.1646 }
				}
			}
		}
	}
}

# Peer endorsed paper
letter_event = {
	id = MNM.1642
	desc = EVTDESC_MNM_1642
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
		opinion = {
			who = FROM
			modifier = opinion_grateful
			years = 10
		}
	}
}

# Peer refuted paper
letter_event = {
	id = MNM.1643
	desc = EVTDESC_MNM_1643
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1643
		opinion = {
			who = FROM
			modifier = opinion_academic_grudge
			years = 15
		}
		reverse_opinion = {
			who = FROM
			modifier = opinion_academic_grudge
			years = 15
		}
	}
}

# Results
character_event = {
	id = MNM.1644
	desc = {
		text = EVTDESCA_MNM_1644
		trigger = {
			has_character_flag = paper_success
		}
	}
	desc = {
		text = EVTDESCB_MNM_1644
		trigger = {
			has_character_flag = paper_failure
		}
	}
	picture = GFX_evt_gathering_of_minds
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		#Calc success/failure
		if = {
			limit = {
				check_variable = {
					which = peer_review_score
					value = 3
				}
			}
			set_character_flag = paper_success
			break = yes
		}
		set_character_flag = paper_failure
	}
	
	option = {
		name = EVTOPTA_MNM_1644
		trigger = {
			has_character_flag =  paper_success
		}
		
		prestige = 75
		add_character_modifier = {
			modifier = published_theorem
			years = 5
		}
		add_society_currency_minor_effect = yes
		hidden_effect = {
			event_target:peer1 = { set_character_flag = paper_success character_event = { id = MNM.1645 } }
			event_target:peer2 = { set_character_flag = paper_success character_event = { id = MNM.1645 } }
			event_target:peer3 = { set_character_flag = paper_success character_event = { id = MNM.1645 } }
			event_target:peer4 = { set_character_flag = paper_success character_event = { id = MNM.1645 } }
			event_target:peer5 = { set_character_flag = paper_success character_event = { id = MNM.1645 } }
		}
	}
	
	option = {
		name = EVTOPTB_MNM_1644
		trigger = {
			has_character_flag =  paper_failure
		}
		
		prestige = -75
		detract_society_currency_minor_effect = yes
		hidden_effect = {
			event_target:peer1 = { set_character_flag = paper_failure character_event = { id = MNM.1645 } }
			event_target:peer2 = { set_character_flag = paper_failure character_event = { id = MNM.1645 } }
			event_target:peer3 = { set_character_flag = paper_failure character_event = { id = MNM.1645 } }
			event_target:peer4 = { set_character_flag = paper_failure character_event = { id = MNM.1645 } }
			event_target:peer5 = { set_character_flag = paper_failure character_event = { id = MNM.1645 } }
		}
	}
	after = {
		clr_character_flag = paper_success
		clr_character_flag = paper_failure
		clr_character_flag = discovered_knowledge_theft
		clr_character_flag = theory_paper_normal_effort
		clr_character_flag = theory_paper_asked_help
		clr_character_flag = theory_paper_stole_work
		clr_character_flag = theory_paper_heavy_investment
		clr_character_flag = theory_paper_revolutionary
		clr_character_flag = theory_paper_excellent
		clr_character_flag = theory_paper_average
		clr_character_flag = theory_paper_simplistic
		clr_character_flag = refuted_paper_@ROOT
	}
}

#Notice event for peers who endorsed the paper
character_event = {
	id = MNM.1645
	desc = {
		text = EVTDESCA_MNM_1645
		trigger = {
			FROM = { has_character_flag = paper_success }
		}
	}
	desc = {
		text = EVTDESCB_MNM_1645
		trigger = {
			FROM = { has_character_flag = paper_failure }
		}
	}
	picture = GFX_evt_gathering_of_minds
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	trigger = {
		NOT = { has_character_flag = refuted_paper_@FROM }
	}
	
	option = {
		name = EVTOPTA_MNM_1645
		trigger = {
			FROM = { has_character_flag = paper_success }
		}
		add_character_modifier = {
			modifier = endorsed_theorem
			years = 5
		}
	}
	
	option = {
		name = EVTOPTB_MNM_1645
		trigger = {
			FROM = { has_character_flag = paper_failure }
		}
	}
}

# Discovered stealing knowledge
character_event = {
	id = MNM.1646
	desc = EVTDESC_MNM_1646
	picture = GFX_evt_scandal
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		clear_delayed_event = { id = MNM.1644 }
	}
	
	option = {
		name = CURSES
		
		prestige = -75
		detract_society_currency_minor_effect = yes
		society = {
			any_society_member = {
				limit = {
					NOT = { character = ROOT }
				}
				opinion = {
					who = ROOT
					modifier = opinion_knowledge_theft
					years = 20
				}
			}
		}
	}
}

#MISC

###Become Society Grand Master (any society)###
character_event = {
	id = MNM.1750
	desc = EVTDESC_MNM_1750
	picture = GFX_evt_society_joining
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	trigger = { 
		is_society_grandmaster = yes 
		NOT = { days_in_society == 0 }
	}
	
	option = { name = EVTOPTA_MNM_1750 }
}

###MisGather ingredients
character_event = {
	id = MNM.1800
	desc = {
		text = EVTDESC_MNM_1800_A
		trigger = {
			NOT = { has_character_flag = quest_gathering_companion }
		}
	}
	desc = {
		text = EVTDESC_MNM_1800_B
		trigger = {
			has_character_flag = quest_gathering_companion
		}
	}
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	has_dlc = "Mystics"
	
	immediate = {
		if = {
			limit = {
				event_target:hermetic_collaborator = {
					always = yes
				}
			}
			event_target:hermetic_collaborator = {
				save_event_target_as = gathering_companion
			}
			set_character_flag = quest_gathering_companion
			break = yes
		}
		# Find apprentice
		random_courtier_or_vassal = {
			limit = {
				has_minor_title = title_hermetics_apprentice
			}
			save_event_target_as = gathering_companion
			ROOT = { set_character_flag = apprentice_hermetic_gathering }
		}
	}
	
	option = { # Look for herbs
		name = EVTOPTA_MNM_1800
		character_event = { id = MNM.1810 days = 20 tooltip = EVTTOOLTIPA_MNM_1800 }
	}
	
	option = { # Hunt for animal parts
		name = EVTOPTB_MNM_1800
		character_event = { id = MNM.1815 days = 20 tooltip = EVTTOOLTIPB_MNM_1800 }
	}
	
	option = { # Shop for ingredients
		name = EVTOPTC_MNM_1800
		character_event = { id = MNM.1820 days = 20 tooltip = EVTTOOLTIPC_MNM_1800 }
	}
	
	option = {	# I don't have time for this now
		name = EVTOPTD_MNM_1800
		hidden_effect = {
			remove_character_modifier = acquire_ingredients_decision_cooldown_timer
		}
	}
	
	after = {
		set_character_flag = do_not_disturb
		clr_character_flag = quest_gathering_companion
		hidden_effect = { character_event = { id = MNM.1825 days = 140 } } # safety flag clearing
	}
}

character_event = { #quest ping
	id = MNM.1801
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		FROM = { society_quest_event = { id = MNM.1802 } }
	}
}

society_quest_event = {
    id = MNM.1802
    desc = EVTDESC_MNM_1802

    is_triggered_only = yes
   
    option = {
		name = ACCEPT

		tooltip = { set_quest = quest_hermetic_gather_ingredients }
		hidden_effect = {
			FROM = {
				set_quest_target = {
					id = quest_hermetic_gather_ingredients
					holder = ROOT
				}
			}
		}

		hidden_effect = { character_event = { id = MNM.1800 days = 5 } }
	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = {
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

character_event = {
	id = MNM.1810
	desc = EVTDESC_MNM_1810
	picture = GFX_evt_bandits
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	trigger = { event_target:gathering_companion = { is_alive = yes } }
	
	option = { # Head out with companion to find herbs.
		name = EVTOPTA_MNM_1810
		trigger = {
			stewardship = 11
			FROM = { stewardship = 11 }
		}
		hidden_effect = {
			event_target:gathering_companion = {
				character_event = { id = MNM.1811 days = 50 random = 40 }
			}
		}
	}
	
	option = { # Head out with companion to find herbs.
		name = EVTOPTB_MNM_1810
		trigger = {
			NOT = { stewardship = 11 }
			NOT = { FROM = { stewardship = 11 } }
			stewardship = 7
			FROM = { stewardship = 7 }
		}
		hidden_effect = {
			event_target:gathering_companion = {
				character_event = { id = MNM.1811 days = 50 random = 40 }
			}
		}
	}
	
	option = { # Head out with companion to find herbs.
		name = EVTOPTC_MNM_1810
		trigger = {
			NOT = { stewardship = 7 }
			NOT = { FROM = { stewardship = 7 } }
		}
		hidden_effect = {
			event_target:gathering_companion = {
				character_event = { id = MNM.1811 days = 50 random = 40 }
			}
		}
	}
}

# Calculate outcome for gathering herbs
character_event = {
	id = MNM.1811
	hide_window = yes
	
	is_triggered_only = yes

	trigger = { event_target:gathering_companion = { is_alive = yes } }
	
	immediate = {
		set_variable = {
			which = gath_try
			value = 5
		}
		set_variable = {
			which = gath_res
			value = 0
		}
		
		while = {
			limit = {
				check_variable = {
					which = gath_try
					value = 1
				}
			}
			random_list = {
				50 = { # Successful gathering
					modifier = {
						factor = 0.5
						FROM = { NOT = { stewardship = 4 } }
					}
					modifier = {
						factor = 0.5
						NOT = { stewardship = 4 }
					}
					modifier = {
						factor = 0.6
						FROM = { NOT = { stewardship = 6 } }
					}
					modifier = {
						factor = 0.6
						NOT = { stewardship = 6 }
					}
					modifier = {
						factor = 0.7
						FROM = { NOT = { stewardship = 8 } }
					}
					modifier = {
						factor = 0.7
						NOT = { stewardship = 8 }
					}
					modifier = {
						factor = 1.2
						FROM = { stewardship = 11 }
					}
					modifier = {
						factor = 1.2
						stewardship = 11
					}
					modifier = {
						factor = 1.2
						FROM = { stewardship = 13 }
					}
					modifier = {
						factor = 1.2
						stewardship = 13
					}
					modifier = {
						factor = 1.2
						FROM = { stewardship = 15 }
					}
					modifier = {
						factor = 1.2
						stewardship = 15
					}
					modifier = {
						factor = 1.2
						FROM = { trait = gardener }
					}
					modifier = {
						factor = 1.2
						trait = gardener
					}
					
					FROM = { 
						change_variable = {
							which = gath_res
							value = 1
						}
					}
				}
				50 = { # Unsuccessful gathering
					modifier = {
						factor = 1.3
						trait = drunkard
					}
				}
			}
			
			
			subtract_variable = {
				which = gath_try
				value = 1
			}
		}
		
		FROM = {
			character_event = { id = MNM.1812 }
		}
	}
}

# Outcome and reaction gathering herbs
character_event = {
	id = MNM.1812
	desc = {
		text = EVTDESC_MNM_1812_A
		trigger = {
			check_variable = {
				which = gath_res
				value = 4
			}
		}
	}
	desc = {
		text = EVTDESC_MNM_1812_B
		trigger = {
			NOT = {
				check_variable = {
					which = gath_res
					value = 4
				}
			}
			check_variable = {
				which = gath_res
				value = 1
			}
		}
	}
	desc = {
		text = EVTDESC_MNM_1812_C
		trigger = {
			NOT = {
				check_variable = {
					which = gath_res
					value = 1
				}
			}
		}
	}
	picture = GFX_evt_bandits
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	trigger = { event_target:gathering_companion = { is_alive = yes } }
	
	option = {
		name = EVTOPTA_MNM_1812
		trigger = {
			check_variable = {
				which = gath_res
				value = 4
			}
		}
		
		if = {
			limit = {
				has_quest = quest_hermetic_gather_ingredients
			}
			clr_quest = quest_hermetic_gather_ingredients
			sound_effect = hermetic_society_acquire_seed
			add_society_currency_medium_effect = yes
		}
		custom_tooltip = { text = EVTTOOLTIP_MNM_1812 }
	}
	
	option = {
		name = EVTOPTB_MNM_1812
		trigger = {
			NOT = {
				check_variable = {
					which = gath_res
					value = 4
				}
			}
			check_variable = {
				which = gath_res
				value = 1
			}
		}
		
		if = {
			limit = {
				has_quest = quest_hermetic_gather_ingredients
			}
			clr_quest = quest_hermetic_gather_ingredients
			sound_effect = hermetic_society_acquire_seed
			add_society_currency_minor_effect = yes
		}
		custom_tooltip = { text = EVTTOOLTIP_MNM_1812 }
	}
	
	option = {
		name = EVTOPTC_MNM_1812
		trigger = {
			NOT = {
				check_variable = {
					which = gath_res
					value = 1
				}
			}
		}
		
		if = {
			limit = {
				has_quest = quest_hermetic_gather_ingredients
			}
			clr_quest = { id = quest_hermetic_gather_ingredients failure = yes }
		}
		random_list = {
			120 = { #no effect
				
			}
			60 = { #poisoned
				if = {
					limit = { has_dlc = "Reapers" }
					give_food_poisoning_effect = yes
					custom_tooltip = {
						text = EVTTOOLTIP_MNM_1812_ILL
					}
				}
				if = {
					limit = { NOT = { has_dlc = "Reapers" } }
					add_trait = ill
				}
			}
		}
	}
	
	after = {
		while = {
			limit = {
				check_variable = {
					which = gath_res
					value = 1
				}
			}
			hermetic_add_herbal_ingredient_effect = yes
			
			subtract_variable = {
				which = gath_res
				value = 1
			}
		}
		remove_do_not_disturb_effect = yes
		clr_character_flag = apprentice_hermetic_gathering
	}
}

character_event = {
	id = MNM.1815
	desc = EVTDESC_MNM_1815
	picture = GFX_evt_hunt
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	trigger = { event_target:gathering_companion = { is_alive = yes } }
	
	option = { # Head out with companion to find animal parts.
		name = EVTOPTA_MNM_1815
		trigger = {
			martial = 11
			FROM = { martial = 11 }
		}
		hidden_effect = {
			event_target:gathering_companion = {
				character_event = { id = MNM.1816 days = 50 random = 40 }
			}
		}
	}
	
	option = { # Head out with companion to find animal parts.
		name = EVTOPTB_MNM_1815
		trigger = {
			NOT = { martial = 11 }
			NOT = { FROM = { martial = 11 } }
			martial = 7
			FROM = { martial = 7 }
		}
		hidden_effect = {
			event_target:gathering_companion = {
				character_event = { id = MNM.1816 days = 50 random = 40 }
			}
		}
	}
	
	option = { # Head out with companion to find animal parts.
		name = EVTOPTC_MNM_1815
		trigger = {
			NOT = { martial = 7 }
			NOT = { FROM = { martial = 7 } }
		}
		hidden_effect = {
			event_target:gathering_companion = {
				character_event = { id = MNM.1816 days = 50 random = 40 }
			}
		}
	}
}

# Calculate outcome for gathering animal parts
character_event = {
	id = MNM.1816
	hide_window = yes
	
	is_triggered_only = yes

	trigger = { event_target:gathering_companion = { is_alive = yes } }
	
	immediate = {
		set_variable = {
			which = gath_try
			value = 5
		}
		set_variable = {
			which = gath_res
			value = 0
		}
		
		while = {
			limit = {
				check_variable = {
					which = gath_try
					value = 1
				}
			}
			random_list = {
				50 = { # Successful gathering
					modifier = {
						factor = 0.5
						FROM = { NOT = { martial = 4 } }
					}
					modifier = {
						factor = 0.5
						NOT = { martial = 4 }
					}
					modifier = {
						factor = 0.6
						FROM = { NOT = { martial = 6 } }
					}
					modifier = {
						factor = 0.6
						NOT = { martial = 6 }
					}
					modifier = {
						factor = 0.7
						FROM = { NOT = { martial = 8 } }
					}
					modifier = {
						factor = 0.7
						NOT = { martial = 8 }
					}
					modifier = {
						factor = 1.2
						FROM = { martial = 11 }
					}
					modifier = {
						factor = 1.2
						martial = 11
					}
					modifier = {
						factor = 1.2
						FROM = { martial = 13 }
					}
					modifier = {
						factor = 1.2
						martial = 13
					}
					modifier = {
						factor = 1.2
						FROM = { martial = 15 }
					}
					modifier = {
						factor = 1.2
						martial = 15
					}
					modifier = {
						factor = 1.2
						FROM = { trait = hunter }
					}
					modifier = {
						factor = 1.2
						trait = hunter
					}
					
					FROM = { 
						change_variable = {
							which = gath_res
							value = 1
						}
					}
				}
				50 = { # Unsuccessful gathering
					modifier = {
						factor = 1.3
						trait = drunkard
					}
				}
			}
			
			
			subtract_variable = {
				which = gath_try
				value = 1
			}
		}
		
		FROM = {
			character_event = { id = MNM.1817 }
		}
	}
}

# Outcome and reaction gathering animal parts
character_event = {
	id = MNM.1817
	desc = {
		text = EVTDESC_MNM_1817_A
		trigger = {
			check_variable = {
				which = gath_res
				value = 4
			}
		}
	}
	desc = {
		text = EVTDESC_MNM_1817_B
		trigger = {
			NOT = {
				check_variable = {
					which = gath_res
					value = 4
				}
			}
			check_variable = {
				which = gath_res
				value = 1
			}
		}
	}
	desc = {
		text = EVTDESC_MNM_1817_C
		trigger = {
			NOT = {
				check_variable = {
					which = gath_res
					value = 1
				}
			}
		}
	}
	picture = GFX_evt_hunt
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	trigger = { event_target:gathering_companion = { is_alive = yes } }
	
	option = {
		name = EVTOPTA_MNM_1817
		trigger = {
			check_variable = {
				which = gath_res
				value = 4
			}
		}
		
		if = {
			limit = {
				has_quest = quest_hermetic_gather_ingredients
			}
			clr_quest = quest_hermetic_gather_ingredients
			sound_effect = hermetic_society_acquire_seed
			add_society_currency_medium_effect = yes
		}
		custom_tooltip = { text = EVTTOOLTIP_MNM_1817 }
	}
	
	option = {
		name = EVTOPTB_MNM_1817
		trigger = {
			NOT = {
				check_variable = {
					which = gath_res
					value = 4
				}
			}
			check_variable = {
				which = gath_res
				value = 1
			}
		}
		
		if = {
			limit = {
				has_quest = quest_hermetic_gather_ingredients
			}
			clr_quest = quest_hermetic_gather_ingredients
			sound_effect = hermetic_society_acquire_seed
			add_society_currency_minor_effect = yes
		}
		custom_tooltip = { text = EVTTOOLTIP_MNM_1817 }
	}
	
	option = {
		name = EVTOPTC_MNM_1817
		trigger = {
			NOT = {
				check_variable = {
					which = gath_res
					value = 1
				}
			}
		}
		
		if = {
			limit = {
				has_quest = quest_hermetic_gather_ingredients
			}
			clr_quest = { id = quest_hermetic_gather_ingredients failure = yes }
		}
		prestige = -25
		add_character_modifier = {
			modifier = disappointing_hunt
			duration = 1095 #3 years
		}
	}
	
	after = {
		while = {
			limit = {
				check_variable = {
					which = gath_res
					value = 1
				}
			}
			hermetic_add_animal_ingredient_effect = yes
			
			subtract_variable = {
				which = gath_res
				value = 1
			}
		}
		remove_do_not_disturb_effect = yes
		clr_character_flag = apprentice_hermetic_gathering
	}
}

character_event = {
	id = MNM.1820
	desc = EVTDESC_MNM_1820
	picture = GFX_evt_market
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	trigger = { event_target:gathering_companion = { is_alive = yes } }
	
	option = { # Head out with companion to shop misc ingredients.
		name = EVTOPTA_MNM_1820
		trigger = {
			diplomacy = 11
			FROM = { diplomacy = 11 }
		}
		hidden_effect = {
			event_target:gathering_companion = {
				character_event = { id = MNM.1821 days = 50 random = 40 }
			}
		}
	}
	
	option = { # Head out with companion to shop misc ingredients.
		name = EVTOPTB_MNM_1820
		trigger = {
			NOT = { diplomacy = 11 }
			NOT = { FROM = { diplomacy = 11 } }
			diplomacy = 7
			FROM = { diplomacy = 7 }
		}
		hidden_effect = {
			event_target:gathering_companion = {
				character_event = { id = MNM.1821 days = 50 random = 40 }
			}
		}
	}
	
	option = { # Head out with companion to shop misc ingredients.
		name = EVTOPTC_MNM_1820
		trigger = {
			NOT = { diplomacy = 7 }
			NOT = { FROM = { diplomacy = 7 } }
		}
		hidden_effect = {
			event_target:gathering_companion = {
				character_event = { id = MNM.1821 days = 50 random = 40 }
			}
		}
	}
}

# Calculate outcome for shopping for misc ingredients
character_event = {
	id = MNM.1821
	hide_window = yes
	
	is_triggered_only = yes

	trigger = { event_target:gathering_companion = { is_alive = yes } }
	
	immediate = {
		set_variable = {
			which = gath_try
			value = 5
		}
		set_variable = {
			which = gath_res
			value = 0
		}
		
		while = {
			limit = {
				check_variable = {
					which = gath_try
					value = 1
				}
			}
			random_list = {
				50 = { # Successful gathering
					modifier = {
						factor = 0.5
						FROM = { NOT = { diplomacy = 4 } }
					}
					modifier = {
						factor = 0.5
						NOT = { diplomacy = 4 }
					}
					modifier = {
						factor = 0.6
						FROM = { NOT = { diplomacy = 6 } }
					}
					modifier = {
						factor = 0.6
						NOT = { diplomacy = 6 }
					}
					modifier = {
						factor = 0.7
						FROM = { NOT = { diplomacy = 8 } }
					}
					modifier = {
						factor = 0.7
						NOT = { diplomacy = 8 }
					}
					modifier = {
						factor = 1.2
						FROM = { diplomacy = 11 }
					}
					modifier = {
						factor = 1.2
						diplomacy = 11
					}
					modifier = {
						factor = 1.2
						FROM = { diplomacy = 13 }
					}
					modifier = {
						factor = 1.2
						diplomacy = 13
					}
					modifier = {
						factor = 1.2
						FROM = { diplomacy = 15 }
					}
					modifier = {
						factor = 1.2
						diplomacy = 15
					}
					modifier = {
						factor = 1.2
						FROM = { trait = gregarious }
					}
					modifier = {
						factor = 1.2
						trait = gregarious
					}
					
					FROM = { 
						change_variable = {
							which = gath_res
							value = 1
						}
					}
				}
				50 = { # Unsuccessful gathering
					modifier = {
						factor = 1.3
						trait = drunkard
					}
				}
			}
			
			
			subtract_variable = {
				which = gath_try
				value = 1
			}
		}
		
		FROM = {
			character_event = { id = MNM.1822 }
		}
	}
}

# Outcome and reaction shopping for misc ingredients
character_event = {
	id = MNM.1822
	desc = {
		text = EVTDESC_MNM_1822_A
		trigger = {
			check_variable = {
				which = gath_res
				value = 4
			}
		}
	}
	desc = {
		text = EVTDESC_MNM_1822_B
		trigger = {
			NOT = {
				check_variable = {
					which = gath_res
					value = 4
				}
			}
			check_variable = {
				which = gath_res
				value = 1
			}
		}
	}
	desc = {
		text = EVTDESC_MNM_1822_C
		trigger = {
			NOT = {
				check_variable = {
					which = gath_res
					value = 1
				}
			}
		}
	}
	picture = GFX_evt_market
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes

	trigger = { event_target:gathering_companion = { is_alive = yes } }
	
	option = {
		name = EVTOPTA_MNM_1822
		trigger = {
			check_variable = {
				which = gath_res
				value = 4
			}
		}
		wealth = -35
		
		if = {
			limit = {
				has_quest = quest_hermetic_gather_ingredients
			}
			clr_quest = quest_hermetic_gather_ingredients
			sound_effect = hermetic_society_acquire_seed
			add_society_currency_medium_effect = yes
		}
		custom_tooltip = { text = EVTTOOLTIP_MNM_1822 }
	}
	
	option = {
		name = EVTOPTB_MNM_1822
		trigger = {
			NOT = {
				check_variable = {
					which = gath_res
					value = 4
				}
			}
			check_variable = {
				which = gath_res
				value = 1
			}
		}
		wealth = -25
		
		if = {
			limit = {
				has_quest = quest_hermetic_gather_ingredients
			}
			clr_quest = quest_hermetic_gather_ingredients
			sound_effect = hermetic_society_acquire_seed
			add_society_currency_minor_effect = yes
		}
		custom_tooltip = { text = EVTTOOLTIP_MNM_1822 }
	}
	
	option = {
		name = EVTOPTC_MNM_1822
		trigger = {
			NOT = {
				check_variable = {
					which = gath_res
					value = 1
				}
			}
		}
		wealth = -15
		if = {
			limit = {
				has_quest = quest_hermetic_gather_ingredients
			}
			clr_quest = { id = quest_hermetic_gather_ingredients failure = yes }
		}
	}
	
	after = {
		while = {
			limit = {
				check_variable = {
					which = gath_res
					value = 1
				}
			}
			hermetic_add_misc_ingredient_effect = yes
			
			subtract_variable = {
				which = gath_res
				value = 1
			}
		}
		remove_do_not_disturb_effect = yes
		clr_character_flag = apprentice_hermetic_gathering
	}
}

character_event = {
	id = MNM.1825
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		remove_do_not_disturb_effect = yes
		clr_character_flag = apprentice_hermetic_gathering
		set_variable = { which = gath_try value = 0 }
		set_variable = { which = gath_res value = 0 }
	}
}

#Misc: apprenticeship
#Ping event for apprenticeship completion
character_event = {
    id = MNM.1413
    hide_window = yes
    is_triggered_only = yes
    trigger = { 
    	liege = {
    		character = FROMFROM
    		is_alive = yes
    		society_member_of = hermetics
    	}
    	has_minor_title = title_hermetics_apprentice

    }
    immediate = { FROMFROM = { character_event = { id = MNM.1414 } } }
}

#Apprenticeship completion
character_event = {
    id = MNM.1414
    desc = EVTDESC_MNM_1414
    picture = GFX_evt_gathering_of_minds
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes
    
    option = { 
		name = EVTOPTA_MNM_1414

        add_society_currency_major_effect = yes

        FROM = { 
        	set_character_flag = completed_apprenticeship 
        	remove_title = title_hermetics_apprentice
        	change_learning = 2
        }
    }
}

#Apprentice died
character_event = {
    id = MNM.1415
    hide_window = yes
    is_triggered_only = yes

    is_in_society = yes
    ai = yes

    trigger = {
    	society_member_of = hermetics
    	has_minor_title = title_hermetics_apprentice
		NOR = {
			death_no_trace_trigger = yes
			death_in_china_trigger = yes
		}
    }

    immediate = {
    	liege = { 
    		character_event = { id = MNM.1416 }
    		if = {
    			limit = { has_character_flag = apprentice_hermetic_gathering }
    			clear_delayed_event = { id = MNM.1825 }
    			character_event = { id = MNM.1825 }
    		}
    	}
    }
}

#Notification of dead apprentice
character_event = {
    id = MNM.1416
    picture = GFX_evt_death
    border = GFX_event_normal_frame_religion

    desc = {
    	trigger = {
    		NOR = {
    			NOT = { opinion = { value = 0 who = FROM } }
    			NOT = { FROM = { learning = 12 } }
    		}
    	}
    	text = EVTDESC_MNM_1416_A
    }
    desc = {
    	trigger = {
    		OR = {
    			NOT = { opinion = { value = 0 who = FROM } }
    			NOT = { FROM = { learning = 12 } }
    		}
    	}
    	text = EVTDESC_MNM_1416_B
    }

    is_triggered_only = yes
    
    option = { 
        name = EVTOPTA_MNM_1416
    }
}

######################################
# Invite Hermetic member to Stargazing
######################################
# Invitation events
letter_event = {
	id = MNM.1920
	desc = EVTDESC_MNM_1920
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = { # Accept
		name = EVTOPTA_MNM_1920
		
		save_event_target_as = stargazing_guest
		hidden_tooltip = { set_variable = { which = stargazing_satisfaction value = 0 } }
		FROMFROM = {
			letter_event = { id = MNM.1921 }
		}
		
		ai_chance = {
			factor = 20
			modifier = {
				factor = 2
				OR = {
					trait = scholar
					trait = mystic
					trait = theologian
				}
			}
			modifier = {
				factor = 2
				trait = gregarious
			}
			modifier = {
				factor = 2
				trait = trusting
			}
			modifier = {
				factor = 1.5
				OR = {
					trait = genius
					trait = quick
				}
			}
			modifier = {
				factor = 1.5
				trait = shrewd
			}
			modifier = {
				factor = 2
				opinion = { who = FROM value = 30 }
			}
			modifier = {
				factor = 3
				opinion = { who = FROM value = 60 }
			}
			modifier = {
				factor = 10
				is_friend = FROM
			}
		}
	}
	
	option = { # Decline
		name = EVTOPTB_MNM_1920
		
		FROMFROM = {
			letter_event = { id = MNM.1922 }
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 2
				trait = content
			}
			modifier = {
				factor = 2
				trait = shy
			}
			modifier = {
				factor = 2
				trait = paranoid
			}
			modifier = {
				factor = 2
				trait = slothful
			}
			modifier = {
				factor = 1.5
				trait = envious
			}
			modifier = {
				factor = 2
				OR = {
					trait = imbecile
					trait = slow
				}
			}
			modifier = {
				factor = 2
				trait = dull
			}
			modifier = {
				factor = 3
				NOT = { opinion = { who = FROM value = -25 } }
			}
			modifier = {
				factor = 3
				NOT = { opinion = { who = FROM value = -50 } }
			}
			modifier = {
				factor = 20
				is_rival = FROM
			}
		}
	}
}

#Invitation accepted
letter_event = {
	id = MNM.1921
	desc = EVTDESC_MNM_1921
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EXCELLENT
		
		reverse_opinion = {
			modifier = opinion_stargazing
			who = FROM
			years = 1
		}
		hidden_tooltip = {
			save_event_target_as = stargazing_host
			character_event = { id = MNM.1925 days = 30 random = 30 }
		}
	}
}

# Invitation declined
letter_event = {
	id = MNM.1922
	desc = EVTDESC_MNM_1922
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_WOL_11117 # That is disappointing
		
		opinion = {
			modifier = opinion_disappointed
			who = FROM
			years = 1
		}
		hidden_tooltip = {
			clr_character_flag = inviting_guests_to_stargazing_timer
			remove_do_not_disturb_effect = yes
			remove_character_modifier = inviting_to_stargazing
		}
	}
}

# Check if able to start stargazing
character_event = {
	id = MNM.1925
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		clr_character_flag = inviting_guests_to_stargazing_timer
		if = {
			limit = {
				OR = {
					war = yes
					trait = incapable
					NOT = { society_member_of = hermetics }
				}
			}
			character_event = { id = MNM.1926 } # Cancel stargazing due to unforeseen circumstances
			break = yes
		}
		character_event = { id = MNM.1928 } # Let stargazing commence!
	}
}

# Cancel stargazing
character_event = {
	id = MNM.1926
	desc = EVTDESC_MNM_1926
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1926
		
		custom_tooltip = {
			text = EVTOPTA_MNM_1926_TOOLTIP
		}
		hidden_tooltip = {
			remove_do_not_disturb_effect = yes
			remove_character_modifier = inviting_to_stargazing
			event_target:stargazing_guest = {
				letter_event = { id = MNM.1927 }
			}
		}
	}
}

letter_event = {
	id = MNM.1927
	desc = EVTDESC_MNM_1927
	border = GFX_event_letter_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_ZE_6005 # What a shame
	}
}

# Guest arrives - What to do before nightfall?
character_event = {
	id = MNM.1928
	desc = EVTDESC_MNM_1928
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		character_event = { id = MNM.1945 days = 20 random = 10 }
	}
	
	option = { # Show observatory
		name = EVTOPTA_MNM_1928
		
		trigger = {
			has_character_flag = built_observatory
		}
		tooltip_info = yes
		custom_tooltip = {
			text = AVAILABLE_DUE_TO_OBSERVATORY
		}
		custom_tooltip = {
			text = EVTOPTA_MNM_1928_TOOLTIP
		}
		event_target:stargazing_guest = { character_event = { id = MNM.1930 } }
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 2
				trait = scholar
			}
		}
	}
	
	option = { # Show fancy equipment
		name = EVTOPTB_MNM_1928
		
		trigger = {
			has_character_flag = owns_observatory_equipment
			NOT = { has_character_flag = built_observatory }
		}
		tooltip_info = yes
		custom_tooltip = {
			text = AVAILABLE_DUE_TO_OBSERVATORY_EQUIPMENT
		}
		
		custom_tooltip = {
			text = EVTOPTB_MNM_1928_TOOLTIP
		}
		event_target:stargazing_guest = { character_event = { id = MNM.1933 } }
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 2
				trait = scholar
			}
		}
	}
	
	option = { # Show nearby location to use for stargazing
		name = EVTOPTC_MNM_1928
		trigger = {
			NOT = { has_character_flag = built_observatory }
		}
		
		custom_tooltip = {
			text = EVTOPTC_MNM_1928_TOOLTIP
		}
		event_target:stargazing_guest = { character_event = { id = MNM.1936 } }
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 2
				trait = gardener
			}
		}
	}
	
	option = { # Sit down for a drink/conversation
		name = EVTOPTD_MNM_1928
		
		custom_tooltip = {
			text = EVTOPTD_MNM_1928_TOOLTIP
		}
		event_target:stargazing_guest = { character_event = { id = MNM.1939 } }
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 4
				trait = gluttonous
			}
			modifier = {
				factor = 2
				trait = hedonist
			}
			modifier = {
				factor = 2
				trait = drunkard
			}
		}
	}
	
	option = { # Spend some time to study together
		name = EVTOPTE_MNM_1928
		
		custom_tooltip = {
			text = EVTOPTE_MNM_1928_TOOLTIP
		}
		event_target:stargazing_guest = { character_event = { id = MNM.1942 } }
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 2
				trait = erudite
			}
			modifier = {
				factor = 2
				trait = patient
			}
		}
	}
}

# Show observatory
character_event = {
	id = MNM.1930
	desc = EVTDESC_MNM_1930
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = { # Guest is impressed
		name = EVTOPTA_MNM_1930
		
		reverse_opinion = {
			modifier = opinion_pleased
			who = FROM
			years = 1
		}
		hidden_tooltip = {
			if = {
				limit = {
					OR = {
						trait = scholar
						trait = mystic
						trait = theologian
						trait = humble
					}
				}
				change_variable = { which = stargazing_satisfaction value = 4 }
			}
			if = {
				limit = {
					NOR = {
						trait = scholar
						trait = mystic
						trait = theologian
						trait = humble
					}
				}
				change_variable = { which = stargazing_satisfaction value = 3 }
			}
			event_target:stargazing_host = { character_event = { id = MNM.1931 days = 7 random = 7 } }
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 2
				trait = scholar
			}
			modifier = {
				factor = 2
				trait = mystic
			}
			modifier = {
				factor = 2
				trait = theologian
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
		}
	}
	
	option = { # Guest is not impressed
		name = EVTOPTB_MNM_1930
		
		reverse_opinion = {
			modifier = not_feeling_apreciated
			who = FROM
			years = 1
		}
		hidden_tooltip = {
			event_target:stargazing_host = { character_event = { id = MNM.1932 days = 7 random = 7 } }
		}
		
		ai_chance = {
			factor = 5
			modifier = {
				factor = 5
				trait = envious
			}
			modifier = {
				factor = 3
				trait = arbitrary
			}
		}
	}
}

character_event = {
	id = MNM.1931
	desc = EVTDESC_MNM_1931
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1931
		
		reverse_opinion = {
			modifier = opinion_impressed
			who = FROM
			years = 2
		}
	}
}

character_event = {
	id = MNM.1932
	desc = EVTDESC_MNM_1932
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1932
		
		reverse_opinion = {
			modifier = opinion_unimpressed
			who = FROM
			years = 2
		}
	}
}

# Show fancy equipment
character_event = {
	id = MNM.1933
	desc = EVTDESC_MNM_1933
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = { # Guest is impressed
		name = EVTOPTA_MNM_1933
		
		reverse_opinion = {
			modifier = opinion_pleased
			who = FROM
			years = 1
		}
		hidden_tooltip = {
			if = {
				limit = {
					OR = {
						trait = scholar
						trait = mystic
						trait = theologian
						trait = humble
					}
				}
				change_variable = { which = stargazing_satisfaction value = 3 }
			}
			if = {
				limit = {
					NOR = {
						trait = scholar
						trait = mystic
						trait = theologian
						trait = humble
					}
				}
				change_variable = { which = stargazing_satisfaction value = 2 }
			}
			event_target:stargazing_host = { character_event = { id = MNM.1934 days = 7 random = 7 } }
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 2
				trait = scholar
			}
			modifier = {
				factor = 2
				trait = mystic
			}
			modifier = {
				factor = 2
				trait = theologian
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
		}
	}
	
	option = { # Guest is not impressed
		name = EVTOPTB_MNM_1933
		
		reverse_opinion = {
			modifier = not_feeling_apreciated
			who = FROM
			years = 1
		}
		hidden_tooltip = {
			event_target:stargazing_host = { character_event = { id = MNM.1935 days = 7 random = 7 } }
		}
		
		ai_chance = {
			factor = 5
			modifier = {
				factor = 5
				trait = envious
			}
			modifier = {
				factor = 3
				trait = arbitrary
			}
		}
	}
}

character_event = {
	id = MNM.1934
	desc = EVTDESC_MNM_1934
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1934
		
		reverse_opinion = {
			modifier = opinion_impressed
			who = FROM
			years = 2
		}
	}
}

character_event = {
	id = MNM.1935
	desc = EVTDESC_MNM_1935
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1935
		
		reverse_opinion = {
			modifier = opinion_unimpressed
			who = FROM
			years = 2
		}
	}
}

# Show nearby location to use for stargazing
character_event = {
	id = MNM.1936
	desc = EVTDESC_MNM_1936
	picture = GFX_evt_stone_church
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = { # Guest approves
		name = EVTOPTA_MNM_1936
		
		reverse_opinion = {
			modifier = opinion_pleased
			who = FROM
			years = 1
		}
		hidden_tooltip = {
			if = {
				limit = {
					OR = {
						trait = architect
						trait = gardener
						trait = diligent
					}
				}
				change_variable = { which = stargazing_satisfaction value = 2 }
			}
			if = {
				limit = {
					NOR = {
						trait = architect
						trait = gardener
						trait = diligent
					}
				}
				change_variable = { which = stargazing_satisfaction value = 1 }
			}
			event_target:stargazing_host = { character_event = { id = MNM.1937 days = 7 random = 7 } }
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 2
				trait = architect
			}
			modifier = {
				factor = 2
				trait = gardener
			}
			modifier = {
				factor = 2
				trait = diligent
			}
		}
	}
	
	option = { # Guest does not approve
		name = EVTOPTB_MNM_1936
		
		reverse_opinion = {
			modifier = not_feeling_apreciated
			who = FROM
			years = 1
		}
		hidden_tooltip = {
			event_target:stargazing_host = { character_event = { id = MNM.1938 days = 7 random = 7 } }
		}
		
		ai_chance = {
			factor = 5
			modifier = {
				factor = 5
				trait = slothful
			}
			modifier = {
				factor = 2
				trait = paranoid
			}
		}
	}
}

character_event = {
	id = MNM.1937
	desc = EVTDESC_MNM_1937
	picture = GFX_evt_stone_church
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1937
		
		reverse_opinion = {
			modifier = opinion_impressed
			who = FROM
			years = 2
		}
	}
}

character_event = {
	id = MNM.1938
	desc = EVTDESC_MNM_1938
	picture = GFX_evt_stone_church
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1938
		
		reverse_opinion = {
			modifier = opinion_unimpressed
			who = FROM
			years = 2
		}
	}
}

# Sit down for a drink/conversation
character_event = {
	id = MNM.1939
	desc = EVTDESC_MNM_1939
	picture = GFX_evt_feast
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = { # Guest enjoyed it
		name = EVTOPTA_MNM_1939
		
		reverse_opinion = {
			modifier = opinion_pleased
			who = FROM
			years = 1
		}
		hidden_tooltip = {
			if = {
				limit = {
					OR = {
						trait = hedonist
						trait = socializer
						trait = gregarious
						trait = gluttonous
						trait = drunkard
					}
				}
				change_variable = { which = stargazing_satisfaction value = 2 }
			}
			if = {
				limit = {
					NOR = {
						trait = hedonist
						trait = socializer
						trait = gregarious
						trait = gluttonous
						trait = drunkard
					}
				}
				change_variable = { which = stargazing_satisfaction value = 1 }
			}
			event_target:stargazing_host = { character_event = { id = MNM.1940 days = 7 random = 7 } }
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 3
				trait = gluttonous
			}
			modifier = {
				factor = 2
				trait = hedonist
			}
			modifier = {
				factor = 2
				trait = socializer
			}
			modifier = {
				factor = 2
				trait = gregarious
			}
			modifier = {
				factor = 2
				trait = drunkard
			}
			modifier = {
				factor = 2
				trait = decadent
			}
		}
	}
	
	option = { # Guest did not enjoy it
		name = EVTOPTB_MNM_1939
		
		reverse_opinion = {
			modifier = not_feeling_apreciated
			who = FROM
			years = 1
		}
		hidden_tooltip = {
			event_target:stargazing_host = { character_event = { id = MNM.1941 days = 7 random = 7 } }
		}
		
		ai_chance = {
			factor = 5
			modifier = {
				factor = 5
				trait = temperate
			}
			modifier = {
				factor = 6
				AND = {
					religion_group = muslim
					NOT = { trait = decadent }
				}
			}
			modifier = {
				factor = 3
				trait = shy
			}
		}
	}
}

character_event = {
	id = MNM.1940
	desc = EVTDESC_MNM_1940
	picture = GFX_evt_feast
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1940
		
		reverse_opinion = {
			modifier = opinion_enjoyed_feast
			who = FROM
			years = 1
		}
	}
}

character_event = {
	id = MNM.1941
	desc = EVTDESC_MNM_1941
	picture = GFX_evt_feast
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1941
		
		reverse_opinion = {
			modifier = opinion_unimpressed
			who = FROM
			years = 2
		}
	}
}

# Spend some time to study together
character_event = {
	id = MNM.1942
	desc = EVTDESC_MNM_1942
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = { # Guest approves
		name = EVTOPTA_MNM_1942
		
		reverse_opinion = {
			modifier = opinion_pleased
			who = FROM
			years = 1
		}
		hidden_tooltip = {
			if = {
				limit = {
					OR = {
						trait = erudite
						trait = scholar
						trait = faqih
						trait = diligent
					}
				}
				change_variable = { which = stargazing_satisfaction value = 2 }
			}
			if = {
				limit = {
					NOR = {
						trait = erudite
						trait = scholar
						trait = faqih
						trait = diligent
					}
				}
				change_variable = { which = stargazing_satisfaction value = 1 }
			}
			event_target:stargazing_host = { character_event = { id = MNM.1943 days = 7 random = 7 } }
		}
		
		ai_chance = {
			factor = 10
			modifier = {
				factor = 2
				trait = erudite
			}
			modifier = {
				factor = 2
				trait = content
			}
			modifier = {
				factor = 2
				trait = scholar
			}
			modifier = {
				factor = 2
				trait = patient
			}
		}
	}
	
	option = { # Guest does not approve
		name = EVTOPTB_MNM_1942
		
		reverse_opinion = {
			modifier = not_feeling_apreciated
			who = FROM
			years = 1
		}
		hidden_tooltip = {
			event_target:stargazing_host = { character_event = { id = MNM.1944 days = 7 random = 7 } }
		}
		
		ai_chance = {
			factor = 5
			modifier = {
				factor = 4
				trait = slothful
			}
			modifier = {
				factor = 4
				trait = wroth
			}
			modifier = {
				factor = 3
				trait = gregarious
			}
		}
	}
}

character_event = {
	id = MNM.1943
	desc = EVTDESC_MNM_1943
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1943
		
		reverse_opinion = {
			modifier = opinion_impressed
			who = FROM
			years = 2
		}
	}
}

character_event = {
	id = MNM.1944
	desc = EVTDESC_MNM_1944
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1944
		
		reverse_opinion = {
			modifier = opinion_unimpressed
			who = FROM
			years = 2
		}
	}
}

# Nightfall - Time to stargaze
character_event = {
	id = MNM.1945
	desc = EVTDESC_MNM_1945
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		character_event = { id = MNM.1961 days = 10 random = 5 }
	}
	
	option = {
		name = EVTOPTA_MNM_1945
		
		custom_tooltip = {
			text = PREPARE_STARGAZING
			
			hidden_tooltip = {
				random_list = {
					10 = { # Make observation about stars
						modifier = {
							factor = 3
							has_character_flag = built_observatory
						}
						modifier = {
							factor = 2
							has_character_flag = owns_observatory_equipment
							NOT = { has_character_flag = built_observatory }
						}
						
						character_event = { id = MNM.1947 days = 5 random = 5 }
					}
					10 = { # Make observation about zodiacs
						modifier = {
							factor = 3
							has_character_flag = built_observatory
						}
						modifier = {
							factor = 2
							has_character_flag = owns_observatory_equipment
							NOT = { has_character_flag = built_observatory }
						}
						
						character_event = { id = MNM.1950 days = 5 random = 5 }
					}
					10 = { # Saw a comet cross the sky
						modifier = {
							factor = 2
							has_character_flag = built_observatory
						}
						modifier = {
							factor = 1.5
							has_character_flag = owns_observatory_equipment
							NOT = { has_character_flag = built_observatory }
						}
						
						character_event = { id = MNM.1953 days = 5 random = 5 }
					}
					20 = { # Learned something new - Nothing major
						character_event = { id = MNM.1955 days = 5 random = 5 }
					}
					20 = { # Could not see anything of interest
						character_event = { id = MNM.1957 days = 5 random = 5 }
					}
					10 = { # Bad weather ruined the night
						modifier = {
							factor = 2
							OR = {
								month = 11
								NOT = { month = 3 }
							}
						}
						
						character_event = { id = MNM.1959 days = 5 random = 5 }
					}
				}
			}
		}
	}
}

# Make observation about stars
character_event = {
	id = MNM.1947
	desc = EVTDESC_MNM_1947
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1947
		
		random_list = {
			10 = {
				military_techpoints = 100
			}
			10 = {
				economy_techpoints = 100
			}
			10 = {
				culture_techpoints = 100
			}
		}
		
		if = {
			limit = {
				NOT = { has_character_modifier = stargazer }
			}
			add_character_modifier = {
				modifier = stargazer
				duration = 1825
			}
		}
		hidden_tooltip = {
			set_character_flag = stargazing_good_outcome
			event_target:stargazing_guest = { character_event = { id = MNM.1948 } }
		}
	}
}

character_event = {
	id = MNM.1948
	desc = EVTDESC_MNM_1948
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1948
		
		random_list = {
			10 = {
				military_techpoints = 50
			}
			10 = {
				economy_techpoints = 50
			}
			10 = {
				culture_techpoints = 50
			}
		}
	}
}

# Make observation about zodiacs
character_event = {
	id = MNM.1950
	desc = EVTDESC_MNM_1950
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1950
		
		military_techpoints = 50
		economy_techpoints = 50
		culture_techpoints = 50
		
		hidden_tooltip = {
			set_character_flag = stargazing_good_outcome
			event_target:stargazing_guest = { character_event = { id = MNM.1951 } }
		}
	}
}

character_event = {
	id = MNM.1951
	desc = EVTDESC_MNM_1951
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1951
		
		military_techpoints = 25
		economy_techpoints = 25
		culture_techpoints = 25
	}
}

# Saw a comet cross the sky
character_event = {
	id = MNM.1953
	desc = EVTDESC_MNM_1953
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1953
		
		military_techpoints = 30
		economy_techpoints = 30
		culture_techpoints = 30
		piety = 25
		
		if = {
			limit = {
				NOR = {
					trait = humble
					trait = proud
				}
			}
			random = {
				chance = 10
				add_trait = humble
				hidden_tooltip = {
					character_event = { id = 38260 } # Notify humble
				}
			}
		}
		hidden_tooltip = {
			set_character_flag = stargazing_good_outcome
			event_target:stargazing_guest = { character_event = { id = MNM.1954 } }
		}
	}
}

character_event = {
	id = MNM.1954
	desc = EVTDESC_MNM_1954
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1954
		
		military_techpoints = 20
		economy_techpoints = 20
		culture_techpoints = 20
		piety = 15
		
		if = {
			limit = {
				NOR = {
					trait = humble
					trait = proud
				}
			}
			random = {
				chance = 10
				add_trait = humble
				hidden_tooltip = {
					character_event = { id = 38260 } # Notify humble
				}
			}
		}
	}
}

# Learned something new - Nothing major
character_event = {
	id = MNM.1955
	desc = EVTDESC_MNM_1955
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1955
		
		hidden_tooltip = {
			set_character_flag = stargazing_good_outcome
			event_target:stargazing_guest = { character_event = { id = MNM.1956 } }
		}
	}
}

character_event = {
	id = MNM.1956
	desc = EVTDESC_MNM_1955 # Reused text
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1955 # Reused text
	}
}

# Could not see anything of interest
character_event = {
	id = MNM.1957
	desc = EVTDESC_MNM_1957
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1957
		
		hidden_tooltip = {
			set_character_flag = stargazing_bad_outcome
			event_target:stargazing_guest = { character_event = { id = MNM.1958 } }
		}
	}
}

character_event = {
	id = MNM.1958
	desc = EVTDESC_MNM_1958
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1958
		
		hidden_tooltip = {
			change_variable = { which = stargazing_satisfaction value = -1 }
		}
	}
}

# Bad weather ruined the night
character_event = {
	id = MNM.1959
	desc = EVTDESC_MNM_1959
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1959
		
		random = {
			chance = 5
			add_trait = depressed
			hidden_tooltip = {
				character_event = {
					id = 38288 #Notify depressed
				}
			}
		}
		hidden_tooltip = {
			set_character_flag = stargazing_bad_outcome
			event_target:stargazing_guest = { character_event = { id = MNM.1960 } }
		}
	}
}

character_event = {
	id = MNM.1960
	desc = EVTDESC_MNM_1959 # Reused text
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1959 # Reused text
		
		hidden_tooltip = {
			change_variable = { which = stargazing_satisfaction value = -1 }
		}
	}
}

# Check outcome
character_event = {
	id = MNM.1961
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		hidden_tooltip = {
			random_list = {
				10 = { # Become friends
					modifier = {
						factor = 2
						event_target:stargazing_guest = {
							check_variable = { which = stargazing_satisfaction value = 3 }
						}
					}
					modifier = {
						factor = 2
						event_target:stargazing_guest = {
							check_variable = { which = stargazing_satisfaction value = 2 }
						}
					}
					modifier = {
						factor = 1.5
						event_target:stargazing_guest = {
							check_variable = { which = stargazing_satisfaction value = 1 }
						}
					}
					modifier = {
						factor = 0
						event_target:stargazing_guest = {
							NOT = { check_variable = { which = stargazing_satisfaction value = 0 } }
						}
					}
					modifier = {
						factor = 2
						event_target:stargazing_guest = {
							opinion = { who = ROOT value = 50 }
						}
					}
					modifier = {
						factor = 0
						event_target:stargazing_guest = {
							is_friend = ROOT
						}
					}
					character_event = { id = MNM.1962 }
				}
				5 = { # Become rivals
					modifier = {
						factor = 4
						event_target:stargazing_guest = {
							NOT = { check_variable = { which = stargazing_satisfaction value = 0 } }
						}
					}
					modifier = {
						factor = 4
						event_target:stargazing_guest = {
							NOT = { opinion = { who = ROOT value = -25 } }
						}
					}
					modifier = {
						factor = 0
						event_target:stargazing_guest = {
							check_variable = { which = stargazing_satisfaction value = 1 }
						}
					}
					modifier = {
						factor = 0
						event_target:stargazing_guest = {
							is_friend = ROOT
						}
					}
					character_event = { id = MNM.1965 }
				}
				50 = { } # Nothing happens
			}
			character_event = { id = MNM.1968 days = 10 random = 5 }
		}
	}
}

# Host and guest become friends
character_event = {
	id = MNM.1962
	desc = EVTDESC_MNM_1962
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1962
		
		add_friend = event_target:stargazing_guest
		
		hidden_tooltip = {
			set_character_flag = stargazing_become_friends
			event_target:stargazing_guest = { character_event = { id = MNM.1963 } }
		}
	}
}

character_event = {
	id = MNM.1963
	desc = EVTDESC_MNM_1963
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1963
		
		tooltip = {
			add_friend = event_target:stargazing_host
		}
	}
}

# Host and guest become rivals
character_event = {
	id = MNM.1965
	desc = EVTDESC_MNM_1965
	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1965
		
		add_rival = event_target:stargazing_guest
		
		hidden_tooltip = {
			event_target:stargazing_guest = { character_event = { id = MNM.1966 } }
		}
	}
}

character_event = {
	id = MNM.1966
	desc = EVTDESC_MNM_1966
	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1966
		
		tooltip = {
			add_rival = event_target:stargazing_host
		}
	}
}

# Morning arrives - Stargazing is over
character_event = {
	id = MNM.1968
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	desc = {
		text = EVTDESC_MNM_1968_A
		trigger = {
			has_character_flag = stargazing_good_outcome
		}
	}
	desc = {
		text = EVTDESC_MNM_1968_B
		trigger = {
			has_character_flag = stargazing_bad_outcome
			NOT = { has_character_flag = stargazing_become_friends }
		}
	}
	desc = {
		text = EVTDESC_MNM_1968_C
		trigger = {
			has_character_flag = stargazing_bad_outcome
			has_character_flag = stargazing_become_friends
		}
	}
	
	immediate = {
		event_target:stargazing_guest = { character_event = { id = MNM.1969 } }
	}
	
	option = {
		name = {
			text = EVTOPTA_MNM_1968_A
			trigger = {
				has_character_flag = stargazing_good_outcome
			}
		}
		name = {
			text = EVTOPTA_MNM_1968_B
			trigger = {
				has_character_flag = stargazing_bad_outcome
				NOT = { has_character_flag = stargazing_become_friends }
			}
		}
		name = {
			text = EVTOPTA_MNM_1968_C
			trigger = {
				has_character_flag = stargazing_bad_outcome
				has_character_flag = stargazing_become_friends
			}
		}
		
		hidden_tooltip = {
			add_character_modifier = {
				name = stargazing_timer
				duration = 1095
				hidden = yes
			}
			remove_do_not_disturb_effect = yes
			clr_character_flag = stargazing_good_outcome
			clr_character_flag = stargazing_bad_outcome
			clr_character_flag = stargazing_become_friends
			remove_character_modifier = inviting_to_stargazing
		}
	}
}

character_event = {
	id = MNM.1969
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	desc = {
		text = EVTDESC_MNM_1968_A
		trigger = {
			FROM = { has_character_flag = stargazing_good_outcome }
		}
	}
	desc = {
		text = EVTDESC_MNM_1968_B
		trigger = {
			FROM = {
				has_character_flag = stargazing_bad_outcome
				NOT = { has_character_flag = stargazing_become_friends }
			}
		}
	}
	desc = {
		text = EVTDESC_MNM_1968_C
		trigger = {
			FROM = {
				has_character_flag = stargazing_bad_outcome
				has_character_flag = stargazing_become_friends
			}
		}
	}
	
	option = {
		name = EVTOPTA_MNM_1969
	}
}

###Magus Power: Write a Magnum Opus###
#Write a Magnum Opus - Start Writing
character_event = {
	id = MNM.1610
	desc = EVTDESC_MNM_1610
	picture = GFX_evt_scientist
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

    option = { #It will be glorious!
    	name = EVTOPTA_MNM_1610
    	add_character_modifier = {
    		modifier = writing_magnum_opus
			years = 2
    	}
    	hidden_effect = {
    		character_event = { id = MNM.1600 days = 90 random = 60 }
    	}
    }
}

#Write a Magnum Opus - Pick Pillar
character_event = {
	id = MNM.1600
	desc = EVTDESC_MNM_1600
	picture = GFX_evt_scientist
    border = GFX_event_normal_frame_religion

    is_triggered_only = yes

    trigger = {	society_member_of = hermetics }

    option = { #write book on Theurgy
    	name = EVTOPTA_MNM_1600
    	trigger = {
    		NOT = {
    			AND = {
    				OR = {
    					has_artifact = magnum_opus_theurgy_ritual_1
						has_artifact = magnum_opus_theurgy_ritual_2
						has_artifact = magnum_opus_theurgy_ritual_3
						has_artifact = magnum_opus_theurgy_ritual_4
    				}
    				OR = {
    					has_artifact = magnum_opus_theurgy_contemplation_1
						has_artifact = magnum_opus_theurgy_contemplation_2
						has_artifact = magnum_opus_theurgy_contemplation_3
						has_artifact = magnum_opus_theurgy_contemplation_4
    				}
    			}
    		}
    	}
    	custom_tooltip = { text = EVTOPTA_MNM_1600_TT }
    	hidden_effect = {
    		character_event = { id = MNM.1601 days = 90 random = 60 }
    	}
    }

    option = { #write book on Astrology
    	name = EVTOPTB_MNM_1600
    	trigger = {
    		NOT = {
    			AND = {
    				OR = {
    					has_artifact = magnum_opus_astrology_stars_1
						has_artifact = magnum_opus_astrology_stars_2
						has_artifact = magnum_opus_astrology_stars_3
						has_artifact = magnum_opus_astrology_stars_4
    				}
    				OR = {
    					has_artifact = magnum_opus_astrology_planets_1
						has_artifact = magnum_opus_astrology_planets_2
						has_artifact = magnum_opus_astrology_planets_3
						has_artifact = magnum_opus_astrology_planets_4
    				}
    			}
    		}
    	}
    	custom_tooltip = { text = EVTOPTB_MNM_1600_TT }
    	hidden_effect = {
    		character_event = { id = MNM.1602 days = 90 random = 60 }
    	}
    }

    option = { #write book on Alchemy
    	name = EVTOPTC_MNM_1600
    	trigger = {
    		NOT = {
    			AND = {
    				OR = {
    					has_artifact = magnum_opus_alchemy_panacea_1
						has_artifact = magnum_opus_alchemy_panacea_2
						has_artifact = magnum_opus_alchemy_panacea_3
						has_artifact = magnum_opus_alchemy_panacea_4
    				}
    				OR = {
    					has_artifact = magnum_opus_alchemy_transmutation_1
						has_artifact = magnum_opus_alchemy_transmutation_2
						has_artifact = magnum_opus_alchemy_transmutation_3
						has_artifact = magnum_opus_alchemy_transmutation_4
    				}
    			}
    		}
    	}
    	custom_tooltip = { text = EVTOPTC_MNM_1600_TT }
    	hidden_effect = {
    		character_event = { id = MNM.1603 days = 90 random = 60 }
    	}
    }
}

#Write a Magnum Opus - Pick type of Theurgy
character_event = {
	id = MNM.1601
	desc = EVTDESC_MNM_1601
	picture = GFX_evt_secluded_in_prayer
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	trigger = {	society_member_of = hermetics }

	option = { #Focus on Rituals/Invocation
		name = EVTOPTA_MNM_1601
		trigger = {
			NOT = {
				OR = {
    				has_artifact = magnum_opus_theurgy_ritual_1
					has_artifact = magnum_opus_theurgy_ritual_2
					has_artifact = magnum_opus_theurgy_ritual_3
					has_artifact = magnum_opus_theurgy_ritual_4
    			}
			}
		}
		custom_tooltip = { text = EVTOPTA_MNM_1601_TT }
    	hidden_effect = {
    		character_event = { id = MNM.1604 days = 90 random = 60 }
    	}
	}

	option = { #Focus on Contemplation
    	name = EVTOPTB_MNM_1601
    	trigger = {
			NOT = {
				OR = {
    				has_artifact = magnum_opus_theurgy_contemplation_1
					has_artifact = magnum_opus_theurgy_contemplation_2
					has_artifact = magnum_opus_theurgy_contemplation_3
					has_artifact = magnum_opus_theurgy_contemplation_4
    			}
			}
		}
    	custom_tooltip = { text = EVTOPTB_MNM_1601_TT }
    	hidden_effect = {
    		character_event = { id = MNM.1605 days = 90 random = 60 }
    	}
    }
}

#Write a Magnum Opus - Pick type of Astrology
character_event = {
	id = MNM.1602
	desc = EVTDESC_MNM_1602
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes
    
    trigger = {	society_member_of = hermetics }

	option = { #Focus on Stars
		name = EVTOPTA_MNM_1602
		trigger = {
			NOT = {
				OR = {
    				has_artifact = magnum_opus_astrology_stars_1
					has_artifact = magnum_opus_astrology_stars_2
					has_artifact = magnum_opus_astrology_stars_3
					has_artifact = magnum_opus_astrology_stars_4
    			}
			}
		}
		custom_tooltip = { text = EVTOPTA_MNM_1602_TT }
    	hidden_effect = {
    		character_event = { id = MNM.1606 days = 90 random = 60 }
    	}
	}

	option = { #Focus on Planets
    	name = EVTOPTB_MNM_1602
    	trigger = {
			NOT = {
				OR = {
    				has_artifact = magnum_opus_astrology_planets_1
					has_artifact = magnum_opus_astrology_planets_2
					has_artifact = magnum_opus_astrology_planets_3
					has_artifact = magnum_opus_astrology_planets_4
    			}
			}
		}
    	custom_tooltip = { text = EVTOPTB_MNM_1602_TT }
    	hidden_effect = {
    		character_event = { id = MNM.1607 days = 90 random = 60 }
    	}
    }
}

#Write a Magnum Opus - Pick type of Alchemy
character_event = {
	id = MNM.1603
	desc = EVTDESC_MNM_1603
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

    trigger = {	society_member_of = hermetics }

	option = { #Focus on Universal Panacea
		name = EVTOPTA_MNM_1603
		trigger = {
			NOT = {
				OR = {
    				has_artifact = magnum_opus_alchemy_panacea_1
					has_artifact = magnum_opus_alchemy_panacea_2
					has_artifact = magnum_opus_alchemy_panacea_3
					has_artifact = magnum_opus_alchemy_panacea_4
    			}
			}
		}
		custom_tooltip = { text = EVTOPTA_MNM_1603_TT }
    	hidden_effect = {
    		character_event = { id = MNM.1608 days = 90 random = 60 }
    	}
	}

	option = { #Focus on Transmutation
    	name = EVTOPTB_MNM_1603
    	trigger = {
			NOT = {
				OR = {
    				has_artifact = magnum_opus_alchemy_transmutation_1
					has_artifact = magnum_opus_alchemy_transmutation_2
					has_artifact = magnum_opus_alchemy_transmutation_3
					has_artifact = magnum_opus_alchemy_transmutation_4
    			}
			}
		}
    	custom_tooltip = { text = EVTOPTB_MNM_1603_TT }
    	hidden_effect = {
    		character_event = { id = MNM.1609 days = 90 random = 60 }
    	}
    }
}

#Write a Magnum Opus - Finish book on Ritualistic/Invocative Theurgy
character_event = {
	id = MNM.1604
	desc = EVTDESC_MNM_1604
	picture = GFX_evt_secluded_in_prayer
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	option = { #Awesome!
		name = EVTOPTA_MNM_1604
		if = {
			limit = {
				NOT = { learning = 12 }
			}
			prestige = 50
    		add_artifact = magnum_opus_theurgy_ritual_1
		}
		if = {
			limit = {
				AND = {
					learning = 12
					NOT = { learning = 18 }
				}
			}
			prestige = 100
    		add_artifact = magnum_opus_theurgy_ritual_2
		}
		if = {
			limit = {
				AND = {
					learning = 18
					NOT = { learning = 25 }
				}
			}
			prestige = 150
    		add_artifact = magnum_opus_theurgy_ritual_3
		}
		if = {
			limit = {
				learning = 25
			}
			prestige = 200
    		add_artifact = magnum_opus_theurgy_ritual_4
		}
		remove_character_modifier = writing_magnum_opus
	}
}

#Write a Magnum Opus - Finish book on Contemplative Theurgy
character_event = {
	id = MNM.1605
	desc = EVTDESC_MNM_1605
	picture = GFX_evt_secluded_in_prayer
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	option = { #Awesome!
		name = EVTOPTA_MNM_1605
		if = {
			limit = {
				NOT = { learning = 12 }
			}
			prestige = 50
    		add_artifact = magnum_opus_theurgy_contemplation_1
		}
		if = {
			limit = {
				AND = {
					learning = 12
					NOT = { learning = 18 }
				}
			}
			prestige = 100
    		add_artifact = magnum_opus_theurgy_contemplation_2
		}
		if = {
			limit = {
				AND = {
					learning = 18
					NOT = { learning = 25 }
				}
			}
			prestige = 150
    		add_artifact = magnum_opus_theurgy_contemplation_3
		}
		if = {
			limit = {
				learning = 25
			}
			prestige = 200
    		add_artifact = magnum_opus_theurgy_contemplation_4
		}
		remove_character_modifier = writing_magnum_opus
	}
}

#Write a Magnum Opus - Finish book on Astrology with focus on Stars
character_event = {
	id = MNM.1606
	desc = EVTDESC_MNM_1606
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	option = { #Awesome!
		name = EVTOPTA_MNM_1606
		if = {
			limit = {
				NOT = { learning = 12 }
			}
			prestige = 50
    		add_artifact = magnum_opus_astrology_stars_1
		}
		if = {
			limit = {
				AND = {
					learning = 12
					NOT = { learning = 18 }
				}
			}
			prestige = 100
    		add_artifact = magnum_opus_astrology_stars_2
		}
		if = {
			limit = {
				AND = {
					learning = 18
					NOT = { learning = 25 }
				}
			}
			prestige = 150
    		add_artifact = magnum_opus_astrology_stars_3
		}
		if = {
			limit = {
				learning = 25
			}
			prestige = 200
    		add_artifact = magnum_opus_astrology_stars_4
		}
		remove_character_modifier = writing_magnum_opus
	}
}

#Write a Magnum Opus - Finish book on Astrology with focus on Planets
character_event = {
	id = MNM.1607
	desc = EVTDESC_MNM_1607
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	option = { #Awesome!
		name = EVTOPTA_MNM_1607
		if = {
			limit = {
				NOT = { learning = 12 }
			}
			prestige = 50
    		add_artifact = magnum_opus_astrology_planets_1
		}
		if = {
			limit = {
				AND = {
					learning = 12
					NOT = { learning = 18 }
				}
			}
			prestige = 100
    		add_artifact = magnum_opus_astrology_planets_2
		}
		if = {
			limit = {
				AND = {
					learning = 18
					NOT = { learning = 25 }
				}
			}
			prestige = 150
    		add_artifact = magnum_opus_astrology_planets_3
		}
		if = {
			limit = {
				learning = 25
			}
			prestige = 200
    		add_artifact = magnum_opus_astrology_planets_4
		}
		remove_character_modifier = writing_magnum_opus
	}
}

#Write a Magnum Opus - Finish book on Alchemy with focus on Universal Panacea
character_event = {
	id = MNM.1608
	desc = EVTDESC_MNM_1608
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	option = { #Awesome!
		name = EVTOPTA_MNM_1608
    	if = {
			limit = {
				NOT = { learning = 12 }
			}
			prestige = 50
    		add_artifact = magnum_opus_alchemy_panacea_1
		}
		if = {
			limit = {
				AND = {
					learning = 12
					NOT = { learning = 18 }
				}
			}
			prestige = 100
    		add_artifact = magnum_opus_alchemy_panacea_2
		}
		if = {
			limit = {
				AND = {
					learning = 18
					NOT = { learning = 25 }
				}
			}
			prestige = 150
    		add_artifact = magnum_opus_alchemy_panacea_3
		}
		if = {
			limit = {
				learning = 25
			}
			prestige = 200
    		add_artifact = magnum_opus_alchemy_panacea_4
		}
		remove_character_modifier = writing_magnum_opus
	}
}

#Write a Magnum Opus - Finish book on Alchemy with focus on Transmutation
character_event = {
	id = MNM.1609
	desc = EVTDESC_MNM_1609
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	option = { #Awesome!
		name = EVTOPTA_MNM_1609
		if = {
			limit = {
				NOT = { learning = 12 }
			}
			prestige = 50
    		add_artifact = magnum_opus_alchemy_transmutation_1
		}
		if = {
			limit = {
				AND = {
					learning = 12
					NOT = { learning = 18 }
				}
			}
			prestige = 100
    		add_artifact = magnum_opus_alchemy_transmutation_2
		}
		if = {
			limit = {
				AND = {
					learning = 18
					NOT = { learning = 25 }
				}
			}
			prestige = 150
    		add_artifact = magnum_opus_alchemy_transmutation_3
		}
		if = {
			limit = {
				learning = 25
			}
			prestige = 200
    		add_artifact = magnum_opus_alchemy_transmutation_4
		}
		remove_character_modifier = writing_magnum_opus
	}
}

#Clear Apprentice title upon death or leaving Hermetics
character_event = {
	id = MNM.1611
	hide_window = yes
	
	is_triggered_only = yes

	trigger = {
		society_member_of = hermetics
	}
	
	immediate = {
		any_courtier_or_vassal = {
			limit = {
				has_minor_title = title_hermetics_apprentice
			}
			remove_title = title_hermetics_apprentice
		}
	}
}

####################################################
# Quest: Observe stars/planets
####################################################
character_event = {
	id = MNM.1828
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		FROM = {
			society_quest_event = { id = MNM.1829 days = 7 random = 7 }
		}
	}
}

society_quest_event = {
	id = MNM.1829
	desc = EVTDESC_MNM_1829

    is_triggered_only = yes
   
    option = {
		name = ACCEPT

		set_quest = quest_hermetics_observe_sky

		hidden_effect = { character_event = { id = MNM.1830 days = 5 } }
	}

	option = {
		name = DECLINE
		custom_tooltip = { text = decline_quest_tooltip }

		add_character_modifier = {
			name = quest_cooldown_timer
			hidden = yes
			days = 1000
		}

		ai_chance = { factor = 0 }
	}
}

character_event = {
	id = MNM.1830
	desc = EVTDESC_MNM_1830
	picture = GFX_evt_book_carolingian_script
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1830
		add_character_modifier = {
			modifier = astronomical_insights_1
			duration = -1
		}
		hidden_effect = {
			character_event = {	id = MNM.1835 days = 40 random = 15	}
		}
	}
}

character_event = { # progress event tombola
	id = MNM.1835
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		random_list = {
			30 = { # Productive evening
				character_event = { id = MNM.1840 }
			}
			30 = { # Neglect interacting with your spouse
				trigger = {
					NOT = { event_target:hermetic_collaborator = { is_married = ROOT } }
				}
				modifier = {
					factor = 0
					NOT = {
						any_spouse = { always = yes }
					}
				}
				
				character_event = { id = MNM.1841 }
			}
			30 = { # Child wants help to sleep
				trigger = {
					any_child = {
						age = 4
						NOT = { age = 14 }
					}
				}
				character_event = { id = MNM.1842 }
			}
			30 = { # Neglect taking care of accounting
				character_event = { id = MNM.1843 }
			}
			30 = { # Friends upset about missed event
				modifier = {
					factor = 0
					NOT = {
						any_friend = { always = yes }
					}
				}
				
				character_event = { id = MNM.1844 }
			}
			30 = { # Absent-mindedness in meetings
				modifier = {
					factor = 0
					NOT = {
						any_courtier_or_vassal = {
							count = 2
							has_job_title = yes
						}
					}
				}
				character_event = { id = MNM.1845 }
			}
			30 = { # Use ingredients
				trigger = {
					has_a_herb_ingredient_trigger = yes
					any_artifact = {
			    		count = 2
			    		has_artifact_flag = ingredient
		    		}
				}
				character_event = { id = MNM.1855 }
			}
		}
	}
}


character_event = { # ending event tombola
	id = MNM.1836
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		random_list = {
			30 = { # Tracking planets
				character_event = { id = MNM.1846 }
			}
			30 = { # Predicting Comet
				character_event = { id = MNM.1847 }
			}
			30 = { # Name a newly found star
				character_event = { id = MNM.1848 }
			}
			30 = { # Observe zodiac stars
				long_character_event = { id = MNM.1850 }
			}
			120 = { # Fail to observe anything of interest
				modifier = {
					factor = 0.5
					has_character_modifier = astronomical_insights_2
				}
				modifier = {
					factor = 0.5
					has_character_modifier = astronomical_insights_3
				}
				modifier = {
					factor = 0.5
					has_character_modifier = astronomical_insights_4
				}
				
				character_event = { id = MNM.1851 }
			}
		}
	}
}

character_event = { # continue studying or conclude my findings?
	id = MNM.1837
	desc = {
		text = EVTDESCA_MNM_1837
		trigger = {
			has_character_modifier = astronomical_insights_1
		}
	}
	desc = {
		text = EVTDESCB_MNM_1837
		trigger = {
			has_character_modifier = astronomical_insights_2
		}
	}
	desc = {
		text = EVTDESCC_MNM_1837
		trigger = {
			has_character_modifier = astronomical_insights_3
		}
	}
	desc = {
		text = EVTDESCD_MNM_1837
		trigger = {
			has_character_modifier = astronomical_insights_4
		}
	}
	picture = GFX_evt_ritual_scroll
	border = GFX_event_normal_frame_religion

	hide_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1837
		custom_tooltip = { text = EVTOPTA_MNM_1837_TT }
		trigger = {
			NOT = { has_character_modifier = astronomical_insights_4 }
		}
		character_event = {	id = MNM.1835 days = 60 random = 20 }
	}
	
	option = {
		name = EVTOPTB_MNM_1837
		custom_tooltip = { text = EVTOPTB_MNM_1837_TT }
		trigger = {
			NOT = { has_character_modifier = astronomical_insights_4 }
		}
		character_event = { id = MNM.1836 days = 20 }
	}
	
	option = {
		name = EVTOPTC_MNM_1837
		custom_tooltip = { text = EVTOPTB_MNM_1837_TT }
		trigger = {
			has_character_modifier = astronomical_insights_4
		}
		custom_tooltip = {
			text = EVTTOOLTIP_MNM_1837
			character_event = { id = MNM.1836 days = 20 }
		}
	}
}

character_event = { # Progress - Productive evening
	id = MNM.1840
	desc = EVTDESC_MNM_1840
	picture = GFX_evt_monk
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	hide_from = yes
	
	option = {
		name = EVTOPTA_MNM_1840
		add_society_currency_trivial_effect = yes
	}
	
	option = {
		name = EVTOPTB_MNM_1840
		trigger = { trait = slothful }
		random = {
			chance = 30
			remove_trait_slothful_effect = yes
		}
	}
	
	option = {
		name = EVTOPTC_MNM_1840
		trigger = { trait = depressed }
		random = {
			chance = 30
			remove_trait = depressed
		}
	}
	
	option = {
		name = EVTOPTD_MNM_1840
		trigger = { trait = envious }
		random = {
			chance = 30
			remove_trait = envious
		}
	}
	
	after = {
		increase_astronomical_insights_modifier_effect = yes
		character_event = { id = MNM.1837 days = 5 }
	}
}

character_event = { # Progress - Neglect interacting with your spouse
	id = MNM.1841
	desc = {
		text = EVTDESCA_MNM_1841
		trigger = {
			NOT = {
				event_target:target_spouse = {
					OR = {
						has_opinion_modifier = {
							modifier = opinion_out_of_touch
							who = ROOT
						}
						has_opinion_modifier = {
							modifier = opinion_out_of_touch_mild
							who = ROOT
						}
					}
				}
			}
		}
	}
	desc = {
		text = EVTDESCB_MNM_1841
		trigger = {
			event_target:target_spouse = {
				OR = {
					has_opinion_modifier = {
						modifier = opinion_out_of_touch
						who = ROOT
					}
					has_opinion_modifier = {
						modifier = opinion_out_of_touch_mild
						who = ROOT
					}
				}
			}
		}
	}
	picture = GFX_evt_quarrel
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		random_spouse = {
			save_event_target_as = target_spouse
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_MNM_1841_1
			trigger = {
				NOT = {
					event_target:target_spouse = {
						OR = {
							has_opinion_modifier = {
								modifier = opinion_out_of_touch
								who = ROOT
							}
							has_opinion_modifier = {
								modifier = opinion_out_of_touch_mild
								who = ROOT
							}
						}
					}
				}
			}
		}
		name = {
			text = EVTOPTA_MNM_1841_2
			trigger = {
				event_target:target_spouse = {
					OR = {
						has_opinion_modifier = {
							modifier = opinion_out_of_touch
							who = ROOT
						}
						has_opinion_modifier = {
							modifier = opinion_out_of_touch_mild
							who = ROOT
						}
					}
				}
			}
		}
		increase_astronomical_insights_modifier_effect = yes
		event_target:target_spouse = {
			if = {
				limit = {
					is_lover = ROOT
				}
				random = {
					chance = 35
					modifier = {
						factor = 2
						OR = {
							has_opinion_modifier = {
								modifier = opinion_out_of_touch
								who = ROOT
							}
							has_opinion_modifier = {
								modifier = opinion_out_of_touch_mild
								who = ROOT
							}
						}
					}
					remove_lover = ROOT
				}
			}
			opinion = {
				who = ROOT
				modifier = opinion_out_of_touch
				years = 10
			}
		}
	}
	
	option = {
		name = {
			text = EVTOPTB_MNM_1841_1
			trigger = {
				NOT = {
					event_target:target_spouse = {
						OR = {
							has_opinion_modifier = {
								modifier = opinion_out_of_touch
								who = ROOT
							}
							has_opinion_modifier = {
								modifier = opinion_out_of_touch_mild
								who = ROOT
							}
						}
					}
				}
			}
		}
		name = {
			text = EVTOPTB_MNM_1841_2
			trigger = {
				event_target:target_spouse = {
					OR = {
						has_opinion_modifier = {
							modifier = opinion_out_of_touch
							who = ROOT
						}
						has_opinion_modifier = {
							modifier = opinion_out_of_touch_mild
							who = ROOT
						}
					}
				}
			}
		}

		event_target:target_spouse = {
			opinion = {
				who = ROOT
				modifier = opinion_out_of_touch_mild
				years = 10
			}
		}
	}
	
	after = {
		character_event = { id = MNM.1837 days = 5 }
	}
}

character_event = { # Progress - Child wants help to sleep
	id = MNM.1842
	desc = EVTDESCA_MNM_1842
	picture = GFX_evt_daughter_asking_father
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		random_child = {
			limit = {
				age = 4
				NOT = { age = 14 }
			}
			save_event_target_as = target_child
		}
    	if = {
    		limit = { has_a_herb_ingredient_trigger = yes }
    		select_random_hermetic_ingredient_herb_effect = yes
    		break = yes
    	}
    	if = {
    		limit = { has_an_animal_part_ingredient_trigger = yes }
    		select_random_hermetic_ingredient_animal_part_effect = yes
    		break = yes
    	}
    	if = {
    		limit = { has_a_powder_ingredient_trigger = yes }
    		select_random_hermetic_ingredient_powder_effect = yes
    		break = yes
    	}
    	if = {
    		limit = { has_a_liquid_ingredient_trigger = yes }
    		select_random_hermetic_ingredient_liquid_effect = yes
    	}
	}	

	option = {
		name = EVTOPTA_MNM_1842
		increase_astronomical_insights_modifier_effect = yes
		event_target:target_child = {
			if = {
				limit = {
					has_dlc = "Conclave"
				}
				random_list = {
					20 = { add_trait = timid }
					20 = { add_trait = indolent }
					20 = { add_trait = fussy }
					40 = { }
				}			
			}
			if = {
				limit = {
					NOT = { has_dlc = "Conclave" }
				}
				random_list = {
					20 = { add_trait = slothful }
					20 = { add_trait = envious }
					20 = { add_trait = arbitrary }
					40 = { }
				}
			}
		}

		event_target:target_child = {
			opinion = {
				who = ROOT
				modifier = opinion_bad_parent
				years = 25
			}
		}
	}
	
	option = {
		name = EVTOPTB_MNM_1842

		event_target:target_child = {
			opinion = {
				who = ROOT
				modifier = opinion_bad_parent
				years = 25
			}
		}
	}
	
	option = { #this will help you sleep (uses ingredient)
		tooltip_info = yes
		custom_tooltip = { text = ingredient_option_available_tt }

		name = {
        	text = EVTOPTC_MNM_1842_herb
        	trigger = { has_selected_herb_ingredient_1_trigger = yes }
        }
        name = {
        	text = EVTOPTC_MNM_1842_animal_part
        	trigger = { has_selected_animal_part_ingredient_1_trigger = yes }
        }		
        name = {
        	text = EVTOPTC_MNM_1842_powder
        	trigger = { has_selected_powder_ingredient_1_trigger = yes }
        }
        name = {
        	text = EVTOPTC_MNM_1842_liquid
        	trigger = { has_selected_liquid_ingredient_1_trigger = yes }
        }

        increase_astronomical_insights_modifier_effect = yes

		if = { # if you gave them a herbal tea...
			limit = {
				has_selected_herb_ingredient_1_trigger = yes
			}
			event_target:target_child = {
				opinion = {
					who = ROOT
					modifier = comforted_opinion
					years = 5
				}
			}
		}

		if = { # if you gave them animal part broth...
			limit = {
				has_selected_animal_part_ingredient_1_trigger = yes
			}
			event_target:target_child = {
				opinion = {
					who = ROOT
					modifier = opinion_cheered_up
					years = 2
				}
			}
		}

		if = { # if you gave them a metal powder...
			limit = {
				has_selected_powder_ingredient_1_trigger = yes
			}
			event_target:target_child = {
				add_character_modifier = {
					modifier = nauseous_from_potion
					years = 1
				}
			}
		}

		if = { # if you fed them mercury, for instance...
			limit = {
				has_selected_liquid_ingredient_1_trigger = yes
			}
			event_target:target_child = {
				add_character_modifier = {
					modifier = nauseous_from_potion
					years = 1
				}
			}
		}

		destroy_selected_ingredient_1_effect = yes

        trigger = {
        	any_artifact = { has_artifact_flag = ingredient }
        }
	}

	after = {
		character_event = { id = MNM.1837 days = 5 }
		hidden_effect = {
			remove_selection_of_ingredients_effect = yes
		}
	}
}

character_event = { # Progress - Neglect taking care of accounting
	id = MNM.1843
	desc = EVTDESC_MNM_1843
	picture = GFX_evt_relic_box
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1843
		increase_astronomical_insights_modifier_effect = yes
		add_character_modifier = {
			modifier = neglected_accounting
			years = 5
		}
		scaled_wealth = {
			value = -0.5
			min = -25
			max = -70
		}
	}
	
	option = {
		name = EVTOPTB_MNM_1843
		scaled_wealth = {
			value = -0.3
			min = -15
			max = -40
		}
	}
	
	after = {
		character_event = { id = MNM.1837 days = 5 }
	}
}

character_event = { # Progress - Friends upset about missed event
	id = MNM.1844
	desc = EVTDESC_MNM_1844
	picture = GFX_evt_bad_news
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		random_friend = {
			save_event_target_as = target_friend
		}

		if = {
    		limit = { has_a_herb_ingredient_trigger = yes }
    		select_random_hermetic_ingredient_herb_effect = yes
    		break = yes
    	}
    	if = {
    		limit = { has_an_animal_part_ingredient_trigger = yes }
    		select_random_hermetic_ingredient_animal_part_effect = yes
    		break = yes
    	}
    	if = {
    		limit = { has_a_powder_ingredient_trigger = yes }
    		select_random_hermetic_ingredient_powder_effect = yes
    		break = yes
    	}
    	if = {
    		limit = { has_a_liquid_ingredient_trigger = yes }
    		select_random_hermetic_ingredient_liquid_effect = yes
    	}
	}
	
	option = {
		name = EVTOPTA_MNM_1844
		increase_astronomical_insights_modifier_effect = yes
		event_target:target_friend = {
			random = {
				chance = 30
				remove_friend = ROOT
			}
			opinion = {
				modifier = opinion_forgot_important_occasion
				who = ROOT
				years = 15
			}
		}
	}
	
	option = {
		name = EVTOPTB_MNM_1844
		event_target:target_friend = {
			opinion = {
				modifier = opinion_forgot_important_occasion_mild
				who = ROOT
				years = 15
			}
		}
	}

	option = {
		tooltip_info = yes
		custom_tooltip = { text = ingredient_option_available_tt }

		name = {
        	text = EVTOPTC_MNM_1844_herb
        	trigger = { has_selected_herb_ingredient_1_trigger = yes }
        }
        name = {
        	text = EVTOPTC_MNM_1844_animal_part
        	trigger = { has_selected_animal_part_ingredient_1_trigger = yes }
        }		
        name = {
        	text = EVTOPTC_MNM_1844_powder
        	trigger = { has_selected_powder_ingredient_1_trigger = yes }
        }
        name = {
        	text = EVTOPTC_MNM_1844_liquid
        	trigger = { has_selected_liquid_ingredient_1_trigger = yes }
        }

		increase_astronomical_insights_modifier_effect = yes

		if = { # if you gave them a herbal tea...
			limit = {
				has_selected_herb_ingredient_1_trigger = yes
			}
			event_target:target_friend = {
				opinion = {
					who = ROOT
					modifier = comforted_opinion
					years = 5
				}
			}
		}

		if = { # if you gave them animal part broth...
			limit = {
				has_selected_animal_part_ingredient_1_trigger = yes
			}
			event_target:target_friend = {
				opinion = {
					who = ROOT
					modifier = opinion_cheered_up
					years = 5
				}
			}
		}

		if = { # if you gave them a metal powder...
			limit = {
				has_selected_powder_ingredient_1_trigger = yes
			}
			event_target:target_friend = {
				opinion = {
					who = ROOT
					modifier = opinion_cheered_up
					years = 5
				}
			}
		}

		if = { # if you fed them mercury, for instance...
			limit = {
				has_selected_liquid_ingredient_1_trigger = yes
			}
			event_target:target_friend = {
				add_character_modifier = {
					modifier = nauseous_from_potion
					years = 1
				}
			}
		}

		destroy_selected_ingredient_1_effect = yes

		trigger = {
        	any_artifact = { has_artifact_flag = ingredient }
        }
	}
	
	after = {
		character_event = { id = MNM.1837 days = 5 }
		remove_selection_of_ingredients_effect = yes
	}
}

character_event = { # Progress - Absent-mindedness in meetings
	id = MNM.1845
	desc = EVTDESC_MNM_1845
	picture = GFX_evt_state_diplomacy
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		random_courtier_or_vassal = {
			limit = {
				has_job_title = yes
			}
			save_event_target_as = councillor1
		}
		random_courtier_or_vassal = {
			limit = {
				has_job_title = yes
				NOT = { character = event_target:councillor1 }
			}
			save_event_target_as = councillor2
		}
	}
	
	option = {
		name = EVTOPTA_MNM_1845
		increase_astronomical_insights_modifier_effect = yes
		
		event_target:councillor2 = {
			opinion = {
				modifier = opinion_fired_from_council
				who = ROOT
				years = 5
			}
			trigger_switch = {
				on_trigger = has_job_title
				job_chancellor = { remove_title = job_chancellor }
				job_marshal = { remove_title = job_marshal }
				job_treasurer = { remove_title = job_treasurer }
				job_spymaster = { remove_title = job_spymaster }
				job_spiritual = { remove_title = job_spiritual }
			}
		}
	}
	
	option = {
		name = EVTOPTB_MNM_1845
		event_target:councillor1 = {
			opinion = {	
				modifier = opinion_angry
				who = ROOT
				years = 5
			}
		}
	}
	
	after = {
		character_event = { id = MNM.1837 days = 5 }
	}
}

# Progress event: use ingredients
character_event = {
    id = MNM.1855
    desc = EVTDESC_MNM_1855
	picture = GFX_evt_experiment
	border = GFX_event_normal_frame_religion

    is_triggered_only = yes
    
    immediate = {
    	select_random_hermetic_ingredient_herb_effect = yes
    	select_random_hermetic_ingredient_animal_part_effect = yes
    	select_random_hermetic_ingredient_liquid_effect = yes
    	select_random_hermetic_ingredient_powder_effect = yes
    }

    option = { # Smoke something...!
        name = EVTOPTA_MNM_1855

        random = {
        	chance = 30
        	increase_astronomical_insights_modifier_effect = yes
        }

		destroy_selected_ingredient_1_effect = yes
    
        trigger = {
        	has_selected_herb_ingredient_1_trigger = yes
        }
    }

    option = { # Cook something...!
        name = EVTOPTB_MNM_1855
        
        random = {
        	chance = 40
        	increase_astronomical_insights_modifier_effect = yes
        }

        destroy_selected_ingredient_2_effect = yes
        
        trigger = {
        	has_selected_animal_part_ingredient_2_trigger = yes
        }
    }

    option = { # I'll keep it under my pillow
        name = EVTOPTC_MNM_1855
        
        random = {
        	chance = 50
        	increase_astronomical_insights_modifier_effect = yes
        }

        destroy_selected_ingredient_2_effect = yes
        
        trigger = {
        	has_selected_powder_ingredient_2_trigger = yes
        }
    }

    option = { # Combine several somethings...!
        tooltip_info = yes
        custom_tooltip = { text = multiple_ingredient_option_available_tt }
        
        name = EVTOPTD_MNM_1855

        random_list = {
        	85 = {
        		increase_astronomical_insights_modifier_effect = yes
        	}
        	15 = {
        		add_maimed_trait_effect = yes
        	}
        }

        destroy_selected_ingredient_1_and_2_effect = yes

        trigger = {
    		has_selected_liquid_ingredient_2_trigger = yes
        }
    }

    option = { #I'd rather not...
    	name = EVTOPTE_MNM_1855
    }

    after = {
		character_event = { id = MNM.1837 days = 5 }
		remove_selection_of_ingredients_effect = yes
	}
}


character_event = { # Outcome - Tracking planets
	id = MNM.1846
	desc = EVTDESC_MNM_1846
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1846
		random = {
			chance = 15
			add_trait = patient
		}
		clr_quest = quest_hermetics_observe_sky
		sound_effect = hermetic_society_observe_planet
		add_mission_succeed_influence_effect = yes
		add_society_currency_medium_effect = yes
		remove_astronomical_insight_modifier_effect = yes
	}
}

character_event = { # Outcome - Predicting star-fall
	id = MNM.1847
	desc = EVTDESC_MNM_1847
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1847 # Invite everyone to this occasion
		character_event = { id = MNM.1853 days = 190 random = 70 }
	}
	
	option = {
		name = EVTOPTB_MNM_1847 # I'll remember the day and observe it myself
		character_event = { id = MNM.1854 days = 190 random = 70 }
	}
}

character_event = { # Outcome - Name a newly found star
	id = MNM.1848
	desc =  EVTDESC_MNM_1848
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	immediate = {
		random_child = {
			limit = {
				NOT = {
					any_sibling = {
						age = PREV
						OR = {
							mother = { character = ROOT }
							father = { character = ROOT }
						}
						NOT = { has_character_modifier = got_named_star }
					}
				}
			}
			save_event_target_as = target_child
		}
		random_spouse = {
			limit = {
				NOT = { has_character_modifier = got_named_star }
			}
			save_event_target_as = target_spouse
		}
		random_friend = {
			limit = {
				NOT = { has_character_modifier = got_named_star }
			}
			save_event_target_as = target_friend
		}
	}
	
	option = { # Name it after my child
		name = EVTOPTA_MNM_1848
		trigger = {
			event_target:target_child = { always = yes }
		}
		
		event_target:target_child = {
			add_character_modifier = {
				modifier = got_named_star
				duration = -1
			}
			opinion = {
				who = ROOT
				modifier = opinion_gift_from_above
				years = 20
			}
			character_event = { id = MNM.1852 }
		}
	}
	
	option = { # Name it after my spouse
		name = EVTOPTB_MNM_1848
		trigger = {
			event_target:target_spouse = { always = yes }
		}
		
		event_target:target_spouse = {
			add_character_modifier = {
				modifier = got_named_star
				duration = -1
			}
			character_event = { id = MNM.1852 }
			if = {
				limit = {
					opinion = {
						who = ROOT
						value = 20
					}
				}
				add_lover = ROOT
				break = yes
			}
			opinion = {
				who = ROOT
				modifier = opinion_gift_from_above
				years = 20
			}
		}
	}
	
	option = { # Name it after a friend
		name = EVTOPTC_MNM_1848
		trigger = {
			event_target:target_friend = { always = yes }
		}
		
		event_target:target_friend = {
			add_character_modifier = {
				modifier = got_named_star
				duration = -1
			}
			character_event = { id = MNM.1852 }
			opinion = {
				who = ROOT
				modifier = opinion_gift_from_above
				years = 20
			}
		}
	}
	
	option = { # Name it after myself
		name = EVTOPTD_MNM_1848
		add_trait = proud
		add_character_modifier = {
			modifier = got_named_star
			duration = -1
		}
	}
	
	after = {
		clr_quest = quest_hermetics_observe_sky
		sound_effect = hermetic_society_observe_planet
		add_mission_succeed_influence_effect = yes
		add_society_currency_medium_effect = yes
		remove_astronomical_insight_modifier_effect = yes
	}
}

long_character_event = { # Outcome - Observe zodiac stars
	id = MNM.1850
	desc = EVTDESC_MNM_1850
	picture = GFX_evt_comet
	border = GFX_event_long_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1850
		add_western_zodiac_trait_effect = yes
		clr_quest = quest_hermetics_observe_sky
		sound_effect = hermetic_society_observe_planet
		add_mission_succeed_influence_effect = yes
		add_society_currency_medium_effect = yes
		remove_astronomical_insight_modifier_effect = yes
	}
}

character_event = { # Outcome - Fail to observe anything of interest
	id = MNM.1851
	desc = EVTDESC_MNM_1851
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1851
		clr_quest = { id = quest_hermetics_observe_sky failure = yes }
		add_mission_fail_influence_effect = yes
		remove_astronomical_insight_modifier_effect = yes
	}
}

character_event = { # Notification - Named star
	id = MNM.1852
	desc = EVTDESC_MNM_1852
	picture = GFX_evt_comet
	border = GFX_event_normal_frame_religion
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_1852
		tooltip = {
			add_character_modifier = {
				modifier = got_named_star
				duration = -1
			}
		}
	}
}

# You invited everyone to this star-fall observation
long_character_event = {
	id = MNM.1853
	picture = GFX_evt_comet
	border = GFX_event_long_frame_religion
	
	is_triggered_only = yes

	desc = {
		text = EVTDESCA_MNM_1853
		trigger = { has_character_flag = comet_success }
	}
	desc = {
		text = EVTDESCB_MNM_1853
		trigger = { has_character_flag = comet_failure }
	}
	
	immediate = {	
		random_list = {
			50 = {
				set_character_flag = comet_success
			}
			50 = {
				modifier = {
					factor = 0.5
					has_character_modifier = astronomical_insights_2
				}
				modifier = {
					factor = 0.5
					has_character_modifier = astronomical_insights_3
				}
				modifier = {
					factor = 0.5
					has_character_modifier = astronomical_insights_4
				}
				
				set_character_flag = comet_failure
			}
		}
	}
	
	option = {
		name = EVTOPTA_MNM_1853
		trigger = { has_character_flag = comet_success }
		
		add_trait = proud
		prestige = 100
		
		clr_quest = quest_hermetics_observe_sky
		sound_effect = hermetic_society_observe_planet
		add_mission_succeed_influence_effect = yes
		add_society_currency_medium_effect = yes
	}
	
	option = {
		name = EVTOPTB_MNM_1853
		trigger = { has_character_flag = comet_failure }
		add_character_modifier = {
			modifier = failed_to_predict_star_fall
		}
		
		clr_quest = { id = quest_hermetics_observe_sky failure = yes }
		add_mission_fail_influence_effect = yes
	}
	
	after = {
		clr_character_flag = comet_success
		clr_character_flag = comet_failure
		remove_astronomical_insight_modifier_effect = yes
	}
}

# You observed the star-fall alone
long_character_event = {
	id = MNM.1854
	picture = GFX_evt_comet
	border = GFX_event_long_frame_religion
	
	is_triggered_only = yes

	desc = {
		text = EVTDESCA_MNM_1854
		trigger = { has_character_flag = comet_success }
	}
	desc = {
		text = EVTDESCB_MNM_1854
		trigger = { has_character_flag = comet_failure }
	}
	
	immediate = {	
		random_list = {
			50 = {
				set_character_flag = comet_success
			}
			50 = {
				modifier = {
					factor = 0.5
					has_character_modifier = astronomical_insights_2
				}
				modifier = {
					factor = 0.5
					has_character_modifier = astronomical_insights_3
				}
				modifier = {
					factor = 0.5
					has_character_modifier = astronomical_insights_4
				}
				
				set_character_flag = comet_failure
			}
		}
	}
	
	option = {
		name = EVTOPTA_MNM_1854
		trigger = { has_character_flag = comet_success }
		
		clr_quest = quest_hermetics_observe_sky
		sound_effect = hermetic_society_observe_planet
		add_mission_succeed_influence_effect = yes
		add_society_currency_medium_effect = yes
	}
	
	option = {
		name = EVTOPTB_MNM_1854
		trigger = { has_character_flag = comet_failure }
		
		clr_quest = { id = quest_hermetics_observe_sky failure = yes }
		add_mission_fail_influence_effect = yes
	}
	
	after = {
		clr_character_flag = comet_success
		clr_character_flag = comet_failure
		remove_astronomical_insight_modifier_effect = yes
	}
}

###########################################################
#########    Inherited ingredient set-up event    #########
###########################################################
character_event = {
    id = MNM.5107
    hide_window = yes
    is_triggered_only = yes

    trigger = {
    	FROM = { has_artifact_flag = ingredient } #the artifact inherited must be an ingredient...
    	NOT = { has_character_flag = dealing_with_inherited_ingredients } #you mustn't already dealing with this...
    }

    immediate = {
    	set_character_flag = dealing_with_inherited_ingredients
    	FROMFROM = { save_event_target_as = previous_ingredient_owner } #does this work on dead folk?
    	character_event = { id = MNM.5108 }
    }
}

#Dealing with inherited ingredients - delays the visible event
character_event = {
    id = MNM.5108
    hide_window = yes
    is_triggered_only = yes

    immediate = {
    	if = {
    		limit = {
    			ai = yes
    			FROMFROM = { has_artifact_flag = ingredient }
    		}
    		FROMFROM = { destroy_artifact = yes }
    	}
    	if = {
    		limit = {
    			ai = no
    			NOT = { has_character_flag = owns_inherited_ingredients }
    		}
    		set_character_flag = owns_inherited_ingredients
    		character_event = { id = MNM.5108 days = 10 } #if this is the first instance of this event, send this event again to check if you ever inherited more than one ingredient...
    		break = yes
    	}
    	if = { #run second time around
    		limit = {  
    			ai = no
    			has_character_flag = owns_inherited_ingredients
    			any_artifact = {
    				count = 2
    				has_artifact_flag = ingredient
    			}
    		}
    		repeat_event = { id = MNM.5109 } #send visible event
    	}
    }
}

#Inherited ingredients - keep or no?
character_event = {
    id = MNM.5109
    picture = GFX_evt_experiment
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes
    
    desc = {
    	text = EVTDESC_MNM_5109_hermetic
    	trigger = {
    		society_member_of = hermetics
    	}
    }
    desc = {
    	text = EVTDESC_MNM_5109_other_society
    	trigger = {
    		NOT = { society_member_of = hermetics }
    		is_in_society = yes
    	}
    }
    desc = {
    	text = EVTDESC_MNM_5109_no_society
    	trigger = {
    		is_in_society = no
    	}
    }
    desc = {
    	text = EVTDESC_MNM_5109_child
    	trigger = {
    		NOT = { age = 16 }
    	}
    }

    immediate = {
    	select_random_hermetic_ingredient_effect = yes
    	select_random_hermetic_ingredient_effect = yes
    }

    option = {      
        name = EVTOPTA_MNM_5109
        destroy_selected_ingredient_1_and_2_effect = yes
        piety = 25
        ai_chance = { factor = 5 }
    }
    option = {      
        name = EVTOPTB_MNM_5109
        destroy_all_ingredients_effect = yes
        piety = 25
        prestige = 25
        ai_chance = { factor = 100 }
    }
    option = {
        name = EVTOPTC_MNM_5109
    }

    after = {
    	remove_selection_of_ingredients_effect = yes
    	clr_character_flag = owns_inherited_ingredients
    	clr_character_flag = dealing_with_inherited_ingredients
    }
}

#Paranoid ward-making (random event, fired from on_society_bi_yearly_pulse)
character_event = {
    id = MNM.5110
    desc = EVTDESC_MNM_5110
    picture = GFX_evt_shady_meeting
    border = GFX_event_normal_frame_intrigue
    is_triggered_only = yes
    capable_only = yes
    
    trigger = {
    	has_dlc = "Mystics"
    	society_member_of = hermetics
    	NOT = { has_character_flag = small_defense_against_dark_forces }
    	NOT = { has_character_flag = medium_defense_against_dark_forces }
    	NOT = { has_character_flag = large_defense_against_dark_forces }

    	OR = {
	    	NOT = {
		    	has_game_rule = {
					name = supernatural_events
					value = off
				}
			}
			NOT = {
		    	has_game_rule = {
					name = devil_worshipers
					value = none
				}
			}
    	}

		any_artifact = {
			count = 3
			has_artifact_flag = ingredient
		}
    }

    immediate = {
    	select_random_hermetic_ingredient_effect = yes
    	select_random_hermetic_ingredient_effect = yes
    }

    option = { #One ingredient is fine
        name = EVTOPTA_MNM_5110
        prestige = 15
        piety = -10
        destroy_selected_ingredient_1_effect = yes

    	clr_character_flag = small_defense_against_dark_forces
    	clr_character_flag = medium_defense_against_dark_forces
    	clr_character_flag = large_defense_against_dark_forces
        set_character_flag = small_defense_against_dark_forces

        ai_chance = { factor = 10 }
    }
    option = { #I want to use both ingredients
        name = EVTOPTB_MNM_5110
        prestige = 25
        piety = -20
        destroy_selected_ingredient_1_and_2_effect = yes

        clr_character_flag = small_defense_against_dark_forces
    	clr_character_flag = medium_defense_against_dark_forces
    	clr_character_flag = large_defense_against_dark_forces
        set_character_flag = medium_defense_against_dark_forces
        
        ai_chance = { factor = 10 }
    }
    option = { #I'll cover my quarters in these things!
        name = EVTOPTC_MNM_5110
        prestige = 35
        piety = -30
        destroy_all_ingredients_effect = yes
        
        clr_character_flag = small_defense_against_dark_forces
    	clr_character_flag = medium_defense_against_dark_forces
    	clr_character_flag = large_defense_against_dark_forces
        set_character_flag = large_defense_against_dark_forces

        ai_chance = { factor = 100 }
    }
    option = { #this is paranoia!
        name = EVTOPTD_MNM_5110
        ai_chance = { factor = 0 }
    }
    after = {
    	remove_selection_of_ingredients_effect = yes
    }
}