# Overrides the custom JD.10070 included in the base mod

namespace = JD

character_event = { #Outcome: Book is finished! It went Great/Good/Decent!
    id = JD.10070    
    title = EVTTITLE_JD_10070
    desc = EVTDESC_JD_10070_A
    picture = GFX_evt_library
    border = GFX_event_normal_frame_religion
    is_triggered_only = yes

    hide_from = yes

    trigger = {
    	is_landed = yes
    }

    immediate = {
    	hidden_effect = {
    		#Fallback in case flags have cleared somehow...
			if = {
				limit = {
					NOR = {
						has_character_flag = decent_book_potential
		        		has_character_flag = good_book_potential
		        		has_character_flag = great_book_potential
					}
				}
				set_character_flag = decent_book_potential
			}

	    	#Evaluates how it's gone, from stats, traits, and choices. The flags unlock quality-level of book (or eliminates a level). Relevant event_targets (spouse/lover?) are saved, for loc (custom book names and descs) and opinion bonuses.
	    	trigger_switch = {
	    		on_trigger = has_character_flag
	    		writing_about_battle = {
	    			random_list = {
	    				10 = { #quality level 1
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = decent_book_potential
	    					}
	    					additive_modifier = {
								value = 10
								has_lifestyle_martial_trigger = no
							}
							additive_modifier = {
								value = 10
								has_education_martial_trigger = no
							}
							additive_modifier = {
								value = 10
								OR = {
									is_the_worst_duelist_trigger = yes
									is_terrible_duelist_trigger = yes
								}
							}
							additive_modifier = {
								value = 10
								NOT = { martial = 5 }
							}
							additive_modifier = {
								value = 10
								NOT = { martial = 10 }
							}
	    					random_list = {
			    				10 = {
			    					add_artifact = how_to_hold_a_sword
			    					random = {
			    						chance = 50
		    							new_artifact = {
		    								set_name = how_to_carry_a_bow
		    								set_description = how_to_carry_a_bow_desc
		    							}
			    					}
			    					trigger = {
				    					NOT = {
											any_artifact = {
												artifact_type = how_to_hold_a_sword
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
				    				random_rival = { save_event_target_as = dedication_target }
			    					add_artifact = lessons_taught_to_me_by_rival_1
			    					new_artifact = {
			    						set_description = lessons_taught_to_me_by_rival_1_desc_rename
			    					}

			    					additive_modifier = {
										value = 10
										any_rival = { is_adult = yes }
									}
									trigger = { 
										any_rival = { is_adult = yes }
										NOT = {
											any_artifact = {
												artifact_type = lessons_taught_to_me_by_rival_1
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
	    					}
	    				}
	    				10 = { #quality level 2
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = good_book_potential
	    					}
	    					additive_modifier = {
								value = 10
								duelist_skill_is_medium_group_trigger = yes
							}
							additive_modifier = {
								value = 10
								OR = {
									trait = misguided_warrior
									trait = tough_soldier
								}
							}
							additive_modifier = {
								value = 10
								OR = {
									has_focus = focus_war
									has_focus = focus_hunting							
								}
							}
	    					random_list = {
			    				10 = {
			    					add_artifact = a_history_of_armor
			    					additive_modifier = {
										value = 10
										trait = administrator
									}
									trigger = {
				    					NOT = {
											any_artifact = {
												artifact_type = a_history_of_armor
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_life_of_root
			    					new_artifact = {
			    						set_description = the_life_of_root_desc_rename
			    					}
			    					additive_modifier = {
										value = 10
										trait = strategist
									}
									additive_modifier = {
										value = 10
										trait = proud
									}
									trigger = {
				    					NOT = {
											any_artifact = {
												artifact_type = the_life_of_root
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = a_soldiers_life
			    					additive_modifier = {
										value = 10
										trait = poet
									}
									trigger = {
				    					NOT = {
											any_artifact = {
												artifact_type = a_soldiers_life
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					random_rival = { save_event_target_as = dedication_target }
			    					add_artifact = lessons_taught_to_me_by_rival_2
			    					new_artifact = {
			    						set_description = lessons_taught_to_me_by_rival_2_desc_rename
			    						random_list = {
			    							50 = {
			    								set_name = lessons_taught_to_me_by_rival_2_rename_1
			    							}
			    							50 = {
			    								set_name = lessons_taught_to_me_by_rival_2_rename_2
			    							}
			    						}
			    					}
			    					additive_modifier = {
										value = 10
										any_rival = { is_adult = yes }
									}
									trigger = { 
										any_rival = { is_adult = yes }
										NOT = {
											any_artifact = {
												artifact_type = lessons_taught_to_me_by_rival_2
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_wisdom_of_the_heavens
			    					additive_modifier = {
										value = 10
										trait = hunter
									}
									additive_modifier = {
										value = 10
										trait = falconer
									}
									additive_modifier = {
										value = 10
										has_focus = focus_hunting
									}
									trigger = {
				    					NOT = {
											any_artifact = {
												artifact_type = the_wisdom_of_the_heavens
												original_owner = { character = ROOT }
											}
										}
										trait = falconer
									}
			    				}
	    					}
	    				}
	    				10 = { #quality level 3 (or 4)
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = great_book_potential
	    					}
	    					additive_modifier = {
								value = 10
								has_lifestyle_martial_trigger = yes
							}
							additive_modifier = {
								value = 10
								has_education_martial_trigger = yes
								NOT = { trait = misguided_warrior }
							}
							additive_modifier = {
								value = 10
								duelist_skill_is_high_group_trigger = yes
							}
							additive_modifier = {
								value = 10
								is_the_best_duelist_trigger = yes
							}
							additive_modifier = {
								value = 10
								NOT = { can_have_more_leadership_traits = yes }
							}
							additive_modifier = {
								value = 10
								OR = {
									has_focus = focus_war
									has_focus = focus_hunting					
								}
							}
							additive_modifier = {
								value = 10
								martial = 10
							}
							additive_modifier = {
								value = 10
								martial = 15
							}
							additive_modifier = {
								value = 10
								martial = 20
							}
	    					random_list = {
			    				10 = {
			    					add_artifact = military_strategy_guide
			    					additive_modifier = {
										value = 10
										trait = strategist
									}
									trigger = {
				    					NOT = {
											any_artifact = {
												artifact_type = military_strategy_guide
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = my_fechtbuch
			    					new_artifact = {
			    						set_name = my_fechtbuch_rename
			    					}

			    					additive_modifier = {
										value = 5
										trait = duelist
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = my_fechtbuch
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = codex_dynasty_name
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = codex_dynasty_name
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_sword_and_buckler
			    					additive_modifier = {
										value = 10
										trait = duelist
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = the_sword_and_buckler
												original_owner = { character = ROOT }
											}
										}
										OR = {
											trait = duelist
											trait = hunter
											trait = strategist
											has_education_martial_trigger = yes
										}
									}
			    				}
			    				10 = {
			    					random_rival = {
			    						limit = { root_attraction_trigger = yes is_adult = yes } #if ROOT can be attracted to them...
			    						save_event_target_as = dedication_target
			    					}
			    					add_artifact = lessons_taught_to_me_by_rival_3
			    					new_artifact = {
			    						set_description = lessons_taught_to_me_by_rival_3_desc_rename
			    					}
			    					additive_modifier = {
										value = 10
										any_rival = { always = yes }
									}
									additive_modifier = {
										value = 10
										OR = {
											trait = lustful
											trait = hedonist									
										}
									}
									trigger = { 
										any_rival = {
											root_attraction_trigger = yes
											is_adult = yes
											OR = {
												ROOT = { has_religion_feature = religion_feature_zun }
												ROOT = { has_religion_feature = religion_holy_family }
												ROOT = { religion = messalian }
												ROOT = { religion = zoroastrian }
												NOT = { is_close_relative = ROOT }
											}
										}
										NOT = {
											any_artifact = {
												artifact_type = lessons_taught_to_me_by_rival_3
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = ordinary_beasts
			    					additive_modifier = {
										value = 10
										has_focus = focus_intrigue
									}
									additive_modifier = {
										value = 10
										trait = arbitrary
									}
									additive_modifier = {
										value = 10
										trait = cruel
									}
									additive_modifier = {
										value = 10
										has_lifestyle_intrigue_trigger = yes
									}
									additive_modifier = {
										value = 10
										is_weak_trigger = yes
									}
									trigger = {
				    					NOT = {
											any_artifact = {
												artifact_type = ordinary_beasts
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_white_animal
			    					new_artifact = {
			    						set_name = the_white_animal_rename
			    						set_description = the_white_animal_desc_rename
			    					}
			    					additive_modifier = {
										value = 10
										trait = hunter
									}
									additive_modifier = {
										value = 10
										trait = falconer
									}
									additive_modifier = {
										value = 10
										has_focus = focus_hunting
									}
									trigger = {
				    					NOT = {
											any_artifact = {
												artifact_type = the_white_animal
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_bestiary
			    					additive_modifier = {
										value = 10
										trait = hunter
									}
									additive_modifier = {
										value = 10
										trait = falconer
									}
									additive_modifier = {
										value = 10
										has_focus = focus_hunting
									}
									trigger = {
				    					NOT = {
											any_artifact = {
												artifact_type = the_bestiary
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_book_of_shadows
			    					additive_modifier = {
										value = 10
										trait = duelist
									}
									additive_modifier = {
										value = 10
										has_education_intrigue_trigger = yes
									}
									additive_modifier = {
										value = 10
										has_focus = focus_intrigue
									}
									additive_modifier = {
										value = 10
										has_lifestyle_intrigue_trigger = yes
									}
									trigger = {
				    					NOT = {
											any_artifact = {
												artifact_type = the_book_of_shadows
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = on_government_type_warfare
			    					new_artifact = {
			    						set_name = on_government_type_warfare_rename
			    						set_description = on_government_type_warfare_desc_rename
			    					}
			    					additive_modifier = {
										value = 10
										trait = strategist
									}
									additive_modifier = {
										value = 10
										has_education_martial_trigger = yes
									}
									additive_modifier = {
										value = 10
										has_focus = focus_war
									}
									additive_modifier = {
										value = 10
										OR = {
											trait = diligent
											trait = organizer
											trait = inspiring_leader
											trait = defensive_leader
										}
									}
									trigger = {
				    					NOT = {
											any_artifact = {
												artifact_type = on_government_type_warfare
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
	    					}
	    				}
	    			}
	    			set_character_flag = wrote_about_battle
	    		}
	    		writing_about_relationships = {
	    			random_list = {
	    				10 = { #quality level 1
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = decent_book_potential
	    					}
	    					additive_modifier = {
								value = 10
								has_bottom_tier_education_trait_trigger = yes
							}
							additive_modifier = {
								value = 10
								OR = {
									NOT = { diplomacy = 1 }
									NOT = { intrigue = 1 }
								}
							}
							additive_modifier = {
								value = 10
								OR = {
									NOT = { diplomacy = 5 }
									NOT = { intrigue = 5 }
								}
							}
							additive_modifier = {
								value = 10
								OR = {
									NOT = { diplomacy = 10 }
									NOT = { intrigue = 10 }
								}
							}
	    					random_list = {
			    				10 = {
			    					add_artifact = to_my_descendants
			    					additive_modifier = {
										value = 10
										trait = stubborn
									}
									additive_modifier = {
										value = 10
										trait = cynical
									}
									additive_modifier = {
										value = 10
										trait = diligent
									}
									additive_modifier = {
										value = 10
										trait = paranoid
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = to_my_descendants
												original_owner = { dynasty = ROOT }
											}
										}
									}
			    				}
			    				10 = {
									random_lover = { save_event_target_as = dedication_target }
			    					add_artifact = in_honor_of_roots_beloved_1
			    					new_artifact = {
			    						set_name = in_honor_of_roots_beloved_1_rename
			    						set_description = in_honor_of_roots_beloved_1_desc_rename_lover
			    					}
			    					additive_modifier = {
										value = 10
										trait = kind
									}
									additive_modifier = {
										value = 10
										trait = shy
									}
									additive_modifier = {
										value = 10
										trait = lustful
									}
			    					trigger = {
			    						has_lover = yes
			    						NOT = {
											any_artifact = {
												artifact_type = in_honor_of_roots_beloved_1
												original_owner = { character = ROOT }
											}
										}
			    					}
			    				}
			    				10 = {
			    					random_spouse = { save_event_target_as = dedication_target }
			    					add_artifact = in_honor_of_roots_beloved_1
			    					new_artifact = {
			    						set_name = in_honor_of_roots_beloved_1_rename
			    						set_description = in_honor_of_roots_beloved_1_desc_rename_spouse
			    					}
			    					additive_modifier = {
										value = 10
										trait = kind
									}
									additive_modifier = {
										value = 10
										trait = shy
									}
			    					trigger = { is_married = yes }
			    				}
			    				10 = {
			    					add_artifact = court_etiquette_1 #only if have no other volumes in the series
			    					trigger = {
			    						NOT = {
			    							any_artifact = {
			    								OR = {
			    									artifact_type = court_etiquette_2
			    									artifact_type = court_etiquette_3    								
			    								}
			    							}
			    						}
			    					}
			    				}
	    					}
	    				}
	    				10 = { #quality level 2
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = good_book_potential
	    					}
	    					additive_modifier = {
								value = 10
								OR = {
									has_focus = focus_intrigue
									has_focus = focus_family
								}
							}
							additive_modifier = {
								value = 10
								NOT = { diplomacy = 10 }
							}
							additive_modifier = {
								value = 10
								NOT = { intrigue = 10 }
							}
	    					random_list = {
	    						10 = {
			    					random_spouse = { save_event_target_as = dedication_target }
			    					add_artifact = in_honor_of_roots_beloved_2
			    					new_artifact = {
			    						set_name = in_honor_of_roots_beloved_2_rename
			    						set_description = in_honor_of_roots_beloved_2_desc_rename_spouse
			    					}
			    					additive_modifier = {
										value = 10
										any_spouse = {
											possibly_romantically_interested_in_ROOT_trigger = yes
										}
									}
									additive_modifier = {
										value = 5
										has_focus = focus_family
									}
									additive_modifier = {
										value = 10
										trait = poet
									}
			    					trigger = {
			    						is_married = yes
			    						NOT = {
											any_artifact = {
												artifact_type = in_honor_of_roots_beloved_2
												original_owner = { character = ROOT }
											}
										}
			    					}
			    				}
			    				10 = {
									random_lover = { save_event_target_as = dedication_target }
			    					add_artifact = in_honor_of_roots_beloved_2
			    					new_artifact = {
			    						set_name = in_honor_of_roots_beloved_2_rename
			    						set_description = in_honor_of_roots_beloved_2_desc_rename_lover
			    					}
			    					additive_modifier = {
										value = 10
										trait = cynical
									}
									additive_modifier = {
										value = 10
										trait = lustful
									}
									additive_modifier = {
										value = 10
										trait = cruel
									}
									additive_modifier = {
										value = 5
										trait = poet
									}
			    					trigger = {
			    						has_lover = yes
			    						NOT = {
			    							any_lover = {
			    								spouse = { character = ROOT }
			    							}
			    						}
			    						NOT = {
											any_artifact = {
												artifact_type = in_honor_of_roots_beloved_2
												original_owner = { character = ROOT }
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = notes_from_a_kitchen
			    					additive_modifier = {
										value = 10
										trait = poet
									}
									additive_modifier = {
										value = 5
										trait = gluttonous
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = notes_from_a_kitchen
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				20 = {
			    					random_artifact = {
			    						limit = {
			    							artifact_type = court_etiquette_1
			    						}
			    						original_artifact_owner = {
			    							save_event_target_as = other_author
			    						}
			    					}
			    					add_artifact = court_etiquette_2 #if you have volume I already!
			    					new_artifact = {
			    						set_description = court_etiquette_2_desc_rename #sets the name of the other author
			    					}

			    					trigger = {
			    						any_artifact = {
			    							artifact_type = court_etiquette_1
			    						}
			    						NOT = {
			    							any_artifact = {
			    								OR = {
			    									artifact_type = court_etiquette_2
			    									artifact_type = court_etiquette_3    								
			    								}
			    							}
			    						}
			    					}
			    				}
			    				10 = {
			    					add_artifact = how_to_write_a_letter
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = how_to_write_a_letter
												original_owner = { character = ROOT }
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = fifty_shades_of_root
			    					new_artifact = {
			    						set_description = fifty_shades_of_root_desc_rename
			    					}
			    					additive_modifier = {
										value = -5
										is_learned_trigger = yes
									}
									additive_modifier = {
										value = 5
										trait = lustful
									}
									additive_modifier = {
										value = 5
										trait = cruel
									}
									additive_modifier = {
										value = 5
										trait = impaler
									}
									additive_modifier = {
										value = 5
										trait = arbitrary
									}
									additive_modifier = {
										value = 5
										is_evil_trigger = yes
									}
			    					trigger = {
			    						OR = {
			    							trait = lustful
			    							trait = hedonist
			    							trait = seducer
			    							trait = seductress
			    						}
			    						NOT = {
											any_artifact = {
												artifact_type = fifty_shades_of_root
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = how_to_make_allies
			    					additive_modifier = {
										value = 10
										trait = shy
									}
									additive_modifier = {
										value = 10
										trait = paranoid
									}
									additive_modifier = {
										value = 10
										trait = ambitious
									}
									additive_modifier = {
										value = 10
										trait = cynical
									}
									additive_modifier = {
										value = 5
										OR = {
											has_education_stewardship_trigger = yes
											has_education_intrigue_trigger = yes									
										}
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = how_to_make_allies
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
	    					}
	    				}
	    				10 = { #quality level 3 (or 4)
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = great_book_potential
	    					}
	    					additive_modifier = {
								value = 10
								OR = {
									has_lifestyle_diplomacy_trigger = yes
									has_lifestyle_intrigue_trigger = yes
								}
							}
							additive_modifier = {
								value = 10
								OR = {
									has_education_diplomacy_trigger = yes
									has_education_intrigue_trigger = yes
								}
							}
							additive_modifier = {
								value = 10
								OR = {
									has_focus = focus_intrigue
									has_focus = focus_family
								}
							}
							additive_modifier = {
								value = 10
								OR = {
									diplomacy = 10
									intrigue = 10
								}
							}
							additive_modifier = {
								value = 10
								OR = {
									diplomacy = 15
									intrigue = 15
								}
							}
							additive_modifier = {
								value = 10
								OR = {
									diplomacy = 20
									intrigue = 20
								}
							}
	    					random_list = {
			    				10 = {
			    					random_spouse = { save_event_target_as = dedication_target }
			    					random_lover = { save_event_target_as = dedication_target }
			    					add_artifact = in_honor_of_roots_beloved_3
			    					new_artifact = { set_name = in_honor_of_roots_beloved_3_rename }
			    					additive_modifier = {
										value = 10
										trait = lustful
									}
									additive_modifier = {
										value = 10
										trait = poet
									}
			    					trigger = {
			    						OR = {
				    						has_lover = yes
				    						is_married = yes
			    						}
			    						NOT = {
											any_artifact = {
												artifact_type = in_honor_of_roots_beloved_3
												original_owner = { character = ROOT }
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = court_etiquette_3 #if you have volume II already!
			    					trigger = {
			    						any_artifact = {
		    								artifact_type = court_etiquette_2
			    						}
			    						NOT = {
			    							any_artifact = {
		    									artifact_type = court_etiquette_3    								
			    							}
			    						}
			    					}
			    				}
			    				10 = {
			    					add_artifact = kama_sutra
			    					trigger = {
			    						OR = {
			    							AND = {
				    							trait = lustful
				    							trait = hedonist		    							
			    							}
			    							trait = seducer
			    							trait = seductress
			    						}
			    						culture_group = indo_aryan_group
			    						NOT = {
											any_artifact = {
												artifact_type = kama_sutra
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = the_art_of_love
			    					if = {
			    						limit = {
			    							culture_group = latin
			    						}
			    						new_artifact = { set_name = the_art_of_love_rename_1 }
			    					}
			    					else = {
			    						new_artifact = { set_name = the_art_of_love_rename_2 }	
			    					}
			    					additive_modifier = {
										value = 10
										trait = lustful
									}
									additive_modifier = {
										value = 10
										trait = poet
									}
									additive_modifier = {
										value = 10
										trait = hedonist
									}
									additive_modifier = {
										value = 10
										has_lifestyle_diplomacy_trigger = yes
									}
									additive_modifier = {
										value = -5
										is_pious_trigger = yes
									}
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = the_art_of_love
												original_owner = { character = ROOT }
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = the_hunchback_of_capital
			    					new_artifact = {
			    						set_name = the_hunchback_of_capital_rename
			    						set_description = the_hunchback_of_capital_desc_rename
			    					}		    					
									additive_modifier = {
										value = 10
										has_lifestyle_diplomacy_trigger = yes
									}
									additive_modifier = {
										value = 10
										NOT = { trait = shy }
									}
									additive_modifier = {
										value = 10
										has_pleasant_trait_trigger = yes
									}
									additive_modifier = {
										value = 10
										trait = honest
									}
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = the_hunchback_of_capital
												original_owner = { character = ROOT }
											}
										}
										trait = hunchback
			    					}
			    				}
			    				10 = {
			    					add_artifact = the_illiad
			    					new_artifact = {
			    						set_description = the_illiad_desc_rename
			    					}
									additive_modifier = {
										value = 10
										has_lifestyle_martial_trigger = yes
									}
									additive_modifier = {
										value = 10
										has_education_martial_trigger = yes
									}
									additive_modifier = {
										value = 10
										trait = poet
									}
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = the_illiad
											}
										}
			    					}
			    				}
			    				10 = {
			    					random_artifact = {
			    						limit = {
			    							artifact_type = the_illiad
			    						}
			    						original_artifact_owner = {
			    							save_event_target_as = other_author
			    						}
			    					}
			    					add_artifact = the_odyssey
			    					new_artifact = {
			    						set_description = the_odyssey_desc_rename
			    					}
									additive_modifier = {
										value = 10
										has_lifestyle_martial_trigger = yes
									}
									additive_modifier = {
										value = 10
										has_education_martial_trigger = yes
									}
									additive_modifier = {
										value = 10
										trait = poet
									}
									additive_modifier = {
										value = 20
										OR = {
											trait = viking
											trait = pirate
											trait = ravager
											trait = seaking
											trait = sea_queen
										}
									}
			    					trigger = {
			    						any_artifact = {
											artifact_type = the_illiad
										}
			    						NOT = {
											any_artifact = {
												artifact_type = the_odyssey
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = contracts_of_the_romans	    					
									additive_modifier = {
										value = 10
										has_education_stewardship_trigger = yes
									}
									additive_modifier = {
										value = 10
										has_lifestyle_stewardship_trigger = yes
									}
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = contracts_of_the_romans
												original_owner = { character = ROOT }
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = speculum_regale	    					
									additive_modifier = {
										value = 10
										is_smart_trigger = yes
									}
									additive_modifier = {
										value = 10
										age = 50
									}
									additive_modifier = {
										value = 10
										age = 70
									}
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = speculum_regale
												original_owner = { character = ROOT }
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = religious_head_culture_courtesy
			    					new_artifact = {
			    						set_name = religious_head_culture_courtesy_rename
			    						set_description = religious_head_culture_courtesy_desc_rename
			    					}
									additive_modifier = {
										value = 10
										is_pious_trigger = yes
									}
									additive_modifier = {
										value = 10
										trait = stubborn
									}
									trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = religious_head_culture_courtesy
												original_owner = { character = ROOT }
											}
										}
										OR = {
											religion = catholic							
											religion = orthodox
											religion = nestorian
											religion = sunni
											religion = shiite
										}
										rightful_religious_head_scope = { always = yes }
			    					}
			    				}
			    				10 = {
			    					add_artifact = keeping_government_court
			    					new_artifact = {
			    						set_name = keeping_government_court_rename
			    						set_description = keeping_government_court_desc_rename
			    					}
									additive_modifier = {
										value = 10
										is_pious_trigger = yes
									}
									additive_modifier = {
										value = 10
										trait = stubborn
									}
									trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = keeping_government_court
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
	    					}
	    				}
	    			}
	    			set_character_flag = wrote_about_relationships
	    		}
	    		writing_about_administration = {
	    			random_list = {
	    				10 = { #quality level 1
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = decent_book_potential
	    					}
	    					additive_modifier = {
								value = 10
								has_bottom_tier_education_trait_trigger = yes
							}
							additive_modifier = {
								value = 10
								NOT = { stewardship = 1 }
							}
							additive_modifier = {
								value = 10
								NOT = { stewardship = 5 }
							}
							additive_modifier = {
								value = 10
								NOT = { stewardship = 10 }
							}
		    				random_list = {
			    				10 = {
			    					add_artifact = culinary_diary
			    					additive_modifier = {
										value = 10
										trait = stubborn
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = culinary_diary
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = yes_I_ate_that
			    					new_artifact = {
							        	set_description = yes_I_ate_that_desc_rename
							        }
							        additive_modifier = {
										value = 10
										trait = arbitrary
									}
									additive_modifier = {
										value = 10
										trait = gluttonous
									}
									additive_modifier = {
										value = 10
										trait = adventurer
									}
									additive_modifier = {
										value = -5
										trait = proud
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = yes_I_ate_that
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_well_dressed_chef
			    					additive_modifier = {
										value = 10
										trait = proud
									}
									additive_modifier = {
										value = 10
										has_fair_trait_trigger = yes
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = the_well_dressed_chef
												original_owner = { character = ROOT }
											}
										}							
									}
			    				}
			    				10 = {
			    					add_artifact = big_book_of_meat
			    					additive_modifier = {
										value = 10
										trait = arbitrary
									}
									additive_modifier = {
										value = 10
										trait = gluttonous
									}
									additive_modifier = {
										value = 10
										trait = hunter
									}
									additive_modifier = {
										value = -5
										trait = proud
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = big_book_of_meat
												original_owner = { character = ROOT }
											}
										}
										NOT = { religion = jain }
									}
			    				}
			    				10 = {
			    					add_artifact = a_book_of_vegetables
			    					additive_modifier = {
										value = 10
										trait = arbitrary
									}
									additive_modifier = {
										value = 10
										trait = gluttonous
									}
									additive_modifier = {
										value = 10
										trait = hunter
									}
									additive_modifier = {
										value = -5
										trait = proud
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = a_book_of_vegetables
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = fruits_the_book
			    					new_artifact = {
							        	set_description = fruits_the_book_desc_rename
							        }
							        additive_modifier = {
										value = -5
										trait = cannibal_trait
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = fruits_the_book
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = shoddy_recipes
			    					additive_modifier = {
										value = -5
										trait = administrator
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = shoddy_recipes
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = bad_fishing_book
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = bad_fishing_book
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
		    				}
	    				}
	    				10 = { #quality level 2
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = good_book_potential
	    					}
	    					additive_modifier = {
								value = 10
								NOT = { stewardship = 15 }
							}
							additive_modifier = {
								value = 10
								OR = {
									has_focus = focus_business
									has_focus = focus_rulership
								}
							}
	    					random_list = {
			    				10 = {
			    					add_artifact = decent_cookbook
			    					trigger = {
										NOT = {
											any_artifact = {
												artifact_type = decent_cookbook
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = honest_recipes
			    					trigger = {
										NOT = {
											any_artifact = {
												artifact_type = honest_recipes
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = gastronomic_tonics #if intrigue/deceitful? (plot power!)
			    					trigger = {
			    						OR = {
			    							has_education_intrigue_trigger = yes
			    							has_lifestyle_intrigue_trigger = yes
			    							intrigue = 10
			    						}
			    						NOT = {
											any_artifact = {
												artifact_type = gastronomic_tonics
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = the_omnivore #if cannibal
			    					trigger = {
			    						trait = cannibal_trait
										NOT = {
											any_artifact = {
												artifact_type = the_omnivore
											}
										}
			    					}
			    				}
			    			}
	    				}
	    				10 = { #quality level 3 (or 4)
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = great_book_potential
	    					}
	    					additive_modifier = {
								value = 10
								has_lifestyle_stewardship_trigger = yes
							}
							additive_modifier = {
								value = 10
								has_education_stewardship_trigger = yes
							}
							additive_modifier = {
								value = 10
								OR = {
									has_focus = focus_business
									has_focus = focus_rulership
								}
							}
							additive_modifier = {
								value = 10
								stewardship = 10
							}
							additive_modifier = {
								value = 10
								stewardship = 15
							}
							additive_modifier = {
								value = 10
								stewardship = 20
							}
	    					random_list = {
			    				10 = {
			    					add_artifact = the_dynasty_cookbook
			    					additive_modifier = {
										value = 10
										has_focus = focus_family
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = the_dynasty_cookbook
												original_owner = { dynasty = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = modest_measures
			    					new_artifact = {
			    						set_description = modest_measures_desc_rename
			    					}
			    					additive_modifier = {
										value = 10
										trait = temperate
									}
									additive_modifier = {
										value = 10
										trait = humble
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = modest_measures
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = good_cookbook
			    				}
			    				10 = {
			    					add_artifact = cookbook_3_roman
			    					new_artifact = {
			    						set_description = cookbook_3_roman_desc_rename
			    					}
			    					trigger = {
			    						culture_group = latin
			    						NOT = {
				    						any_artifact = {
												artifact_type = cookbook_3_roman
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = cookbook_3_arabic
			    					trigger = {
			    						culture_group = arabic
			    						NOT = {
				    						any_artifact = {
												artifact_type = cookbook_3_arabic
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = cookbook_3_chinese_group
			    					trigger = {
			    						culture_group = chinese_group
			    						NOT = {
				    						any_artifact = {
												artifact_type = cookbook_3_chinese_group
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = cookbook_3_central_german
			    					new_artifact = {
			    						set_description = cookbook_3_central_german_desc_rename
			    					}
			    					trigger = {
			    						culture_group = central_germanic
			    						NOT = {
				    						any_artifact = {
												artifact_type = cookbook_3_central_german
											}
										}
			    					}
			    				}
			    				10 = {
			    					add_artifact = on_culture_architecture
			    					additive_modifier = {
										value = 10
										trait = architect
									}
									additive_modifier = {
										value = 10
										trait = organizer
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = on_culture_architecture
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = how_to_build_a_well
			    					additive_modifier = {
										value = 10
										trait = architect
									}
									additive_modifier = {
										value = 10
										trait = stubborn
									}
									additive_modifier = {
										value = 10
										is_smart_trigger = yes
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = how_to_build_a_well
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = gardens_of_planet
			    					new_artifact = {
			    						set_name = gardens_of_planet_rename
			    					}
									additive_modifier = {
										value = -5
										NOT = { society_member_of = hermetics }
									}
									additive_modifier = {
										value = 10
										trait = gardener
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = gardens_of_planet
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = treatise_on_fishing
			    					additive_modifier = {
										value = 10
										trait = hunter
									}
									additive_modifier = {
										value = 10
										trait = falconer
									}
									additive_modifier = {
										value = 10
										trait = gardener
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = treatise_on_fishing
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
	    					}
	    				}
	    			}
	    			set_character_flag = wrote_about_administration
	    		}
	    		writing_about_religion = {
	    			random_list = {
	    				10 = { #quality level 1
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = decent_book_potential
	    					}
	    					additive_modifier = {
								value = 10
								NOT = { learning = 1 }
							}
							additive_modifier = {
								value = 10
								NOT = { learning = 5 }
							}
							additive_modifier = {
								value = 10
								NOT = { learning = 10 }
							}
							additive_modifier = {
								value = 10
								has_bottom_tier_education_trait_trigger = yes
							}
	    					random_list = {
			    				10 = {
			    					add_artifact = in_honor_of_highgod
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = in_honor_of_highgod
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = faith_eternal
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = faith_eternal
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = what_do_monks_wear
			    					trigger = {
			    						OR = {
			    							is_monastic_member_trigger = yes
			    							religion_group = christian
			    							religion_group = indian_group
			    						}
			    						NOT = {
											any_artifact = {
												artifact_type = what_do_monks_wear
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = learning_languages_1
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = learning_languages_1
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = choice_passages
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = choice_passages
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
	    					}
	    				}
	    				10 = { #quality level 2
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = good_book_potential
	    					}
	    					additive_modifier = {
								value = 10
								NOT = { learning = 15 }
							}
							additive_modifier = {
								value = 10
								OR = {
									has_focus = focus_theology
									has_focus = focus_scholarship
								}
							}
							
	    					random_list = {
			    				10 = {
			    					add_artifact = hymns_to_highgod
			    					additive_modifier = {
										value = 10
										trait = poet
									}
									trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = hymns_to_highgod
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = learning_languages_2
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = learning_languages_2
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = unnatural_history
			    					additive_modifier = {
										value = 10
										trait = hedonist
									}
									additive_modifier = {
										value = 10
										trait = drunkard
									}
									additive_modifier = {
										value = 10
										trait = depressed
									}
									additive_modifier = {
										value = 10
										is_impious_trigger = yes
									}
									additive_modifier = {
										value = 10
										is_devil_worshiper_trigger = yes
									}
									additive_modifier = {
										value = 10
										age = 60
									}
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = unnatural_history
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = human_anatomy
									additive_modifier = {
										value = 20
										trait = cannibal_trait
									}
									additive_modifier = {
										value = 20
										trait = physician
									}
									additive_modifier = {
										value = 10
										trait = impaler
									}
									additive_modifier = {
										value = 10
										trait = erudite
									}
									additive_modifier = {
										value = 10
										has_lifestyle_learning_trigger = yes
									}
									additive_modifier = {
										value = 10
										has_lifestyle_intrigue_trigger = yes
									}
									additive_modifier = {
										value = 10
										has_education_intrigue_trigger = yes
									}
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = human_anatomy
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = maladies_and_remedies
									additive_modifier = {
										value = 10
										trait = physician
									}
									additive_modifier = {
										value = 10
										trait = erudite
									}
									additive_modifier = {
										value = 10
										has_lifestyle_learning_trigger = yes
									}
									additive_modifier = {
										value = 10
										has_lifestyle_intrigue_trigger = yes
									}
									additive_modifier = {
										value = 10
										has_education_intrigue_trigger = yes
									}
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = maladies_and_remedies
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					random_courtier = {
			    						limit = { culture = horse }
			    						save_event_target_as = dedication_target
			    					}
			    					add_artifact = equine_maxims
			    					new_artifact = {
			    						set_name = equine_maxims_rename
			    					}
									additive_modifier = {
										value = 10
										culture = horse
									}
									additive_modifier = {
										value = 30
			    						any_courtier = {
			    							culture = horse
			    						}
									}
									additive_modifier = {
										value = 10
			    						any_courtier = {
			    							count = 2
			    							culture = horse
			    						}
									}
			    					trigger = {
			    						any_courtier = {
			    							culture = horse
			    						}
			    						NOT = {
											any_artifact = {
												artifact_type = equine_maxims
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
	    					}
	    				}
	    				10 = { #quality level 3 (or 4)
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = great_book_potential
	    					}
	    					additive_modifier = {
								value = 10
								has_lifestyle_learning_trigger = yes
							}
							additive_modifier = {
								value = 10
								has_education_learning_trigger = yes
							}
							additive_modifier = {
								value = 10
								is_monastic_member_trigger = yes
							}
							additive_modifier = {
								value = 10
								OR = {
									has_focus = focus_theology
									has_focus = focus_scholarship
								}
							}
							additive_modifier = {
								value = 10
								learning = 10
							}
							additive_modifier = {
								value = 10
								learning = 15
							}
							additive_modifier = {
								value = 10
								learning = 20
							}
	    					random_list = {
			    				10 = {
			    					add_artifact = a_history_of_churches
			    					additive_modifier = {
										value = 10
										trait = architect
									}
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = a_history_of_churches
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = how_to_worship
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = how_to_worship
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_not_actual_holy_book #lunatic only
			    					additive_modifier = {
										value = 10
										trait = lunatic
									}
									additive_modifier = {
										value = 10
										trait = possessed
									}
			    					trigger = {
			    						trait = lunatic
			    						NOT = { any_artifact = { artifact_type = the_not_actual_holy_book } }
			    					}
			    				}
			    				10 = {
			    					add_artifact = the_spirits
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = the_spirits
												original_owner = { character = ROOT }
											}
										}
										religion_group = pagan_group
									}
			    				}
			    				10 = {
			    					add_artifact = learning_languages_3
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = learning_languages_3
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = learning_languages_4
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = learning_languages_4
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_republic
			    					new_artifact = {
			    						set_name = the_republic_rename
			    					}
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = the_republic
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_confessions_of_root
									additive_modifier = {
										value = -3
										trait = drunkard
									}
									additive_modifier = {
										value = -3
										trait = depressed
									}
									additive_modifier = {
										value = 10
										is_pious_trigger = yes
									}
									additive_modifier = {
										value = 10
										is_monastic_member_trigger = yes
									}
									additive_modifier = {
										value = 10
										age = 40
									}
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = the_confessions_of_root
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
								10 = {
			    					add_artifact = the_book_of_healing
									additive_modifier = {
										value = -5
										is_learned_trigger = yes
									}
									additive_modifier = {
										value = 10
										is_pious_trigger = yes
									}
									additive_modifier = {
										value = 10
										OR = {
											is_monastic_member_trigger = yes
											society_member_of = hermetics
										}
									}
									additive_modifier = {
										value = 10
										age = 40
									}
									additive_modifier = {
										value = 5
										has_lifestyle_learning_trigger = yes
									}
									additive_modifier = {
										value = 5
										has_education_learning_trigger = yes
									}
			    					trigger = {
			    						culture_group = arabic
			    						NOT = {
											any_artifact = {
												artifact_type = the_book_of_healing
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = comforting_poetry
									additive_modifier = {
										value = 20
										trait = poet
									}
									additive_modifier = {
										value = 10
										trait = stressed
									}
									additive_modifier = {
										value = 20
										trait = depressed
									}
			    					trigger = {
			    						OR = {
			    							trait = stressed
			    							trait = depressed
			    						}
			    						NOT = {
											any_artifact = {
												artifact_type = comforting_poetry
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = equine_sequins
									additive_modifier = {
										value = 20
										has_education_stewardship_trigger = yes
									}
									additive_modifier = {
										value = 10
										trait = stressed
									}
									additive_modifier = {
										value = 10
										culture = horse
									}
									additive_modifier = {
										value = 10
										any_courtier = {
			    							culture = horse
			    						}
									}
			    					trigger = {
			    						any_courtier = {
			    							culture = horse
			    						}
			    						NOT = {
											any_artifact = {
												artifact_type = comforting_poetry
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
	    					}
	    				}
	    			}
	    			set_character_flag = wrote_about_religion
	    		}
	    		writing_about_dynasty = {
	    			random_list = {
	    				10 = { #quality level 1
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = decent_book_potential
	    					}
	    					random_list = {
			    				10 = {
			    					add_artifact = to_my_descendants
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = to_my_descendants
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
								10 = {
			    					add_artifact = the_legend_of_roots_ancestors_1
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = the_legend_of_roots_ancestors_1
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
	    					}
	    				}
	    				10 = { #quality level 2
	    					trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = good_book_potential
	    					}
	    					random_list = {
			    				10 = {
			    					add_artifact = records_of_roots_dynasty
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = records_of_roots_dynasty
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_legend_of_roots_ancestors_2
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = the_legend_of_roots_ancestors_2
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
	    					}
	    				}
	    				10 = { #quality level 3 (or 4)
	    				    trigger = { #trigger for the following randomlist (certain quality needed)...
	    						has_character_flag = great_book_potential
	    					}
	    					random_list = {
			    				
			    				10 = {
			    					add_artifact = the_legend_of_roots_ancestors_3
			    					trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = the_legend_of_roots_ancestors_3
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = a_story_about_my_aunt
									additive_modifier = {
										value = 10
				    					any_dynasty_member = {
				    						trait = adventurer
				    					}
									}
									additive_modifier = {
										value = 5
				    					trait = poet
									}
									additive_modifier = { #If you actually have an aunt...
										value = 10
				    					any_dynasty_member = {
				    						is_female = yes
											parent_sibling_of_root_trigger = yes
											NOT = { any_spouse = { character = ROOT } }
				    					}
									}
									trigger = { NOT = { any_artifact = { artifact_type = a_story_about_my_aunt } } }
			    				}
			    				10 = {
			    					add_artifact = the_dynasty_cookbook
			    					additive_modifier = {
										value = 10
										trait = gluttonous
									}	
									additive_modifier = {
										value = 10
										trait = hedonist
									}
									additive_modifier = {
										value = 10
										trait = drunkard
									}
									trigger = {
										NOT = {
											any_artifact = {
												artifact_type = the_dynasty_cookbook
												original_owner = { dynasty = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_annals_of_roots_dynasty
			    					additive_modifier = {
										value = 10
										trait = proud
									}
									trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = the_annals_of_roots_dynasty
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_legendary_dynasty_warrior #about you!
			    					new_artifact = {
			    						set_name = the_legendary_dynasty_warrior_root
			    					}
			    					additive_modifier = {
										value = 10
										trait = brave
									}
									additive_modifier = {
										value = 10
										is_member_of_any_warrior_lodge_trigger = yes
									}
									additive_modifier = {
										value = 10
										prestige = 500
									}
									trigger = {
										any_owned_bloodline = {
											has_bloodline_flag = legendary_warrior_lodge_bloodline
											founder = { character = ROOT }
										}
			    						NOT = {
											any_artifact = {
												artifact_type = the_legendary_dynasty_warrior
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					random_owned_bloodline = {
			    						limit = { has_bloodline_flag = legendary_warrior_lodge_bloodline }
				    					founder = { save_event_target_as = warrior_relative }
				    				}
			    					add_artifact = the_legendary_dynasty_warrior #about a relative
			    					new_artifact = {
			    						set_name = the_legendary_dynasty_warrior_not_root
			    						set_description = the_legendary_dynasty_warrior_desc_not_root
			    					}
			    					additive_modifier = {
										value = 10
										trait = brave
									}
									additive_modifier = {
										value = 10
										is_member_of_any_warrior_lodge_trigger = yes
									}
									additive_modifier = {
										value = 10
										prestige = 500
									}
									trigger = {
										any_owned_bloodline = {
											has_bloodline_flag = legendary_warrior_lodge_bloodline
											founder = { NOT = { character = ROOT } }
										}
			    						NOT = {
											any_artifact = {
												artifact_type = the_legendary_dynasty_warrior
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					random_owned_bloodline = {
			    						limit = { has_bloodline_flag = saintly_bloodline }
				    					founder = { save_event_target_as = saintly_relative }
				    				}
			    					add_artifact = the_saintly_relative
			    					new_artifact = {
			    						set_name = the_saintly_relative_1 #contains event-target, so need to be "set"
			    						set_description = the_saintly_relative_desc
			    					}

			    					additive_modifier = {
										value = 10
										trait = zealous
									}
									additive_modifier = {
										value = 10
										is_christian_monastic_member_trigger = yes
									}
									additive_modifier = {
										value = 10
										trait = celibate
									}
									trigger = {
										any_owned_bloodline = {
											has_bloodline_flag = saintly_bloodline
											founder = { religion = ROOT }
										}
			    						NOT = {
											any_artifact = {
												artifact_type = the_saintly_relative
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
			    				10 = {
			    					add_artifact = the_secret_history_of_culture
			    					additive_modifier = {
										value = 10
										trait = proud
									}
									additive_modifier = {
										value = 10
										culture = mongol
									}
									trigger = {
			    						NOT = {
											any_artifact = {
												artifact_type = the_secret_history_of_culture
												original_owner = { character = ROOT }
											}
										}
									}
			    				}
	    					}
	    				}
	    			}
	    			set_character_flag = wrote_about_dynasty
	    		}
	    	}
	    	new_artifact = {
	    		save_event_target_as = new_book #for effects and localization purposes!
	    	}
	    }
    }

    option = {  #How swell!
        name = {
        	text = EVTOPTA_JD_10070_A #I suppose we got a little sidetracked...
        	trigger = {
        		event_target:new_book = {
    				quality = 1
    				NOT = { quality = 2 }
    			}
    			NOT = { trait = lunatic }
        	}
        }
        name = {
        	text = EVTOPTA_JD_10070_B #I felt inspired...!
        	trigger = {
        		event_target:new_book = {
    				quality = 2
    				NOT = { quality = 3 }
    			}
    			NOT = { trait = lunatic }
        	}
        }
        name = {
        	text = EVTOPTA_JD_10070_C #It was all worth the hard work.
        	trigger = {
        		event_target:new_book = {
    				OR = {
    					quality = 3
    					quality = 4
    				}
    			}
    			NOT = { trait = lunatic }
    			NOT = { trait = poet }
        	}
        }
        name = {
        	text = EVTOPTA_JD_10070_lunatic #Should've dedicated it to demons in my head...
        	trigger = {
    			trait = lunatic
        	}
        }
        name = {
        	text = EVTOPTA_JD_10070_dying #At least we finished it before I died!
        	trigger = {
        		OR = {
        			age = 75
        			AND = {
        				NOT = { has_character_flag = disease_not_serious }
        				has_disease_trigger = yes
        			}
        		}
        		NOT = { trait = lunatic }
        	}
        }
        name = {
        	text = EVTOPTA_JD_10070_great_poet #Perhaps I have found my calling?
        	trigger = {
        		event_target:new_book = {
    				OR = {
    					quality = 3
    					quality = 4
    				}
    			}
    			NOT = { trait = lunatic }
    			trait = poet
        	}
        }

        custom_tooltip = {
        	text = new_book_added_tt
        }

    	if = { #Add some prestige...
    		limit = {
    			event_target:new_book = {
    				quality = 1
    				NOT = { quality = 2 }
    			}
    		}
    		prestige = 20
    	}
    	if = {
    		limit = {
    			event_target:new_book = {
    				quality = 2
    				NOT = { quality = 3 }
    			}
    		}
    		prestige = 50
    	}
    	if = {
    		limit = {
    			event_target:new_book = {
    				OR = {
    					quality = 3
    					quality = 4
    				}
    			}
    		}
    		prestige = 100
    	}
		
		mbb_author_update_variables_composed_book = yes
		
    	if = { #add opinion bonus with the correct targets...
    		limit = { event_target:dedication_target = { always = yes } }

    		if = {
    			limit = {
    				event_target:dedication_target = {
    					OR = {
    						is_lover = ROOT
    						any_spouse = { character = ROOT }
    					}
    				}
				}
				reverse_opinion = {
					who = event_target:dedication_target
					modifier = opinion_flattered
					years = 20
				}
    		}
    		if = {
    			limit = {
    				event_target:dedication_target = {
    					is_rival = ROOT
    					NOT = { is_lover = ROOT }
    					NOT = { any_spouse = { character = ROOT } }
    				}
    			}
    			reverse_opinion = {
					who = event_target:dedication_target
					modifier = opinion_strangely_flattered
					years = 20
				}
    		}

		}
    }

    after = { #Clear and set all relevant flags...
    	if = {
    		limit = {
    			has_character_flag = wrote_about_battle
    			has_character_flag = wrote_about_relationships
    			has_character_flag = wrote_about_administration
    			has_character_flag = wrote_about_religion
    			has_character_flag = wrote_about_dynasty
    		}
    		set_character_flag = has_explored_all_topics
    	}

    	clr_character_flag = writing_about_battle
		clr_character_flag = writing_about_relationships
		clr_character_flag = writing_about_administration
		clr_character_flag = writing_about_religion
		clr_character_flag = writing_poetry
		clr_character_flag = writing_about_dynasty
		clr_character_flag = decent_book_potential
		clr_character_flag = good_book_potential
		clr_character_flag = great_book_potential
		clr_character_flag = hide_martial_this_time
		clr_character_flag = hide_relationships_this_time
		clr_character_flag = hide_administration_this_time
		clr_character_flag = hide_learning_this_time
		clr_character_flag = currently_working_on_a_book
		
		add_character_modifier = {
			name = uninspired
			duration = 7300
		}

		hidden_effect = {
			remove_character_modifier = writing_a_book
		}
    }
}