###########################################
#                                         #
# M&M Monastic Artifacts Events           #
#                                         #
# ID MNM.9000-MNM.9999		          #
#                                         #
###########################################

#IDs:
#9000-9199 Mathilda
#9200-9399 Henrik / Milla
#9400-9599 David
#9600-9799 / 9030-9032 Drikus
#9800-9898 Axel
#9899-9999 Joel

namespace = MNM

###Tweaked events start here###
###Smith artifacts now have fixed price###

###Crown jewels events###
character_event = {
    id = MNM.9100
    desc = EVTDESC_MNM_9100
    picture = GFX_evt_treasure_chamber
    border = GFX_event_normal_frame_economy

    hide_from = yes
    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    immediate = { #Selecting gender of the goldsmith
    	hidden_effect = {
			random_list = {
				15 = { #Woman
					modifier = { factor = 2 primary_title = { has_law = status_of_women_2 } }
					modifier = { factor = 2 primary_title = { has_law = status_of_women_3 } }
					modifier = { factor = 2 primary_title = { has_law = status_of_women_4 } }
					modifier = { factor = 6 has_game_rule = { name = gender value = all } } 
					create_random_steward  = {
	        			age = 45
		        		random_traits = yes
		        		female = yes
		        		dynasty = none
		        		attributes = {
		        			stewardship = 3
		        		}
		        		historical = yes
		        	}
		        	new_character = { 
		        		save_event_target_as = smith
		        		set_character_flag = ai_flag_refuse_marriage
		        		set_character_flag = ai_flag_refuse_concubinage
		        		set_character_flag = cannot_marry
						will_not_marry_effect = yes
		        	}
				} 
				85 = { #Man
		        	create_random_steward  = {
		        		age = 45
		        		random_traits = yes
		        		female = no
		        		dynasty = none
		        		attributes = {
		        			stewardship = 3
		        		}
		        		historical = yes
					}
		        	new_character = {
		        		save_event_target_as = smith
		        		set_character_flag = ai_flag_refuse_marriage
		        		set_character_flag = cannot_marry
						will_not_marry_effect = yes
					}
				}
			}
			event_target:smith = {
				health = 3
        		give_nickname = nick_the_goldsmith
        		random_list = { #Stewardship
        			15 = { change_stewardship = 1 }
        			25 = { change_stewardship = 3 }
        			20 = { change_stewardship = 5 }
        			10 = { change_stewardship = 7 }
        		}
        		random_list = { #Personality
        			1 = { add_trait = greedy }
        			1 = { add_trait = envious }
        			1 = { add_trait = charitable }
        			1 = { add_trait = diligent }
        			1 = { add_trait = deceitful }
        		}
        		random = {
        			chance = 30
        			modifier = {
        				factor = 2
        				trait = indulgent_wastrel
        			}
        			upgrade_education_effect = yes
        		}
			}
		}
    }

    #Yes, invite them!
    option = { 
        name = EVTOPTA_MNM_9100
        custom_tooltip = { text = EVTOPTA_MNM_9100_TT }
        #custom_tooltip = { text = employ_a_smith_stewardship_tt }
        hidden_effect = {
        	save_event_target_as = smith_employer
        	event_target:smith = {
        		character_event = { id = MNM.9101 } 
        	}
        }
    }

    #Don't invite them
    option = {
        name = EVTOPTB_MNM_9100
        custom_tooltip = { text = EVTOPTB_MNM_9100_TT }
        hidden_effect = {
        	event_target:smith = {
        		leave_court_and_die_effect = yes
        	}
        }
    }
}

#Ping event for goldsmith
character_event = {
    id = MNM.9101
    hide_window = yes
    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    immediate = { event_target:smith_employer = { character_event = { id = MNM.9103 } } }
}

character_event = {
    id = MNM.9103
    desc = EVTDESC_MNM_9103
    picture = GFX_evt_emissary
    border = GFX_event_normal_frame_economy

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    #The best money can buy
    option = {
        name = EVTOPTA_MNM_9103
        trigger = { prestige = 2000 }
        tooltip_info = yes
        custom_tooltip = { text = available_due_to_prestige_tt }
        custom_tooltip = { text = EVTOPTA_MNM_9103_TT }

        wealth = -1500

        hidden_effect = {
        	event_target:smith = { set_character_flag = expensive_jewels }
        	set_character_flag = expensive_jewels
			random_list = {
				40 = { #Success
        			modifier = { factor = 0.7 FROM = { stewardship <= 2 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 4 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 6 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 8 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 10 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 10 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 12 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 14 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 16 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 18 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 20 } }
        			modifier = { factor = 1.3 FROM = { trait = greedy } }
        			modifier = { factor = 1.3 FROM = { trait = diligent } }
        			modifier = { factor = 1.3 FROM = { trait = patient } }
        			modifier = { factor = 1.3 FROM = { is_smart_trigger = yes } }
        			set_character_flag = goldsmith_success
				}
				60 = { #Fail
        			set_character_flag = goldsmith_fail
				}
				10 = { #Steal
        			modifier = { factor = 1.3 FROM = { trait = envious } }
        			modifier = { factor = 0.2 FROM = { trait = charitable } }
        			modifier = { factor = 0.2 FROM = { trait = content } }
        			modifier = { factor = 1.5 FROM = { trait = ambitious } }
        			modifier = { factor = 1.3 FROM = { trait = deceitful } }
        			set_character_flag = goldsmith_steal
				}
	    	}
        	character_event = { id = MNM.9111 days = 50 random = 100 }
        	character_event = { id = MNM.9133 days = 20 random = 5 } #tombola for random events
        }
    	ai_chance = {
    		factor = 33
    		modifier = {
    			tier = EMPEROR
    			factor = 10
			}
    		modifier = {
    			OR = {
    				tier = KING	
    				tier = DUKE
    			}
    			factor = 3
    		}
    		modifier = {
    			NOR = {
    				wealth = 200
    				yearly_income = 50
    			}
    			factor = 0
    		}
    	}
    }

    #Something nice
    option = {
        name = EVTOPTB_MNM_9103
        custom_tooltip = { text = EVTOPTB_MNM_9103_TT }

        wealth = -1000

        hidden_effect = {
        	event_target:smith = { set_character_flag = good_jewels }
        	set_character_flag = good_jewels
        	random_list = {
				60 = { #Success
        			modifier = { factor = 0.7 FROM = { stewardship <= 2 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 4 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 6 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 8 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 10 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 10 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 12 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 14 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 16 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 18 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 20 } }
        			modifier = { factor = 1.3 FROM = { trait = greedy } }
        			modifier = { factor = 1.3 FROM = { trait = diligent } }
        			modifier = { factor = 1.3 FROM = { trait = patient } }
        			modifier = { factor = 1.3 FROM = { is_smart_trigger = yes } }
        			set_character_flag = goldsmith_success
				}
				40 = { #Fail
        			set_character_flag = goldsmith_fail
				}
				10 = { #Steal
				  	modifier = { factor = 1.3 FROM = { trait = envious } }
        			modifier = { factor = 0.2 FROM = { trait = charitable } }
        			modifier = { factor = 0.2 FROM = { trait = content } }
        			modifier = { factor = 1.5 FROM = { trait = ambitious } }
        			modifier = { factor = 1.3 FROM = { trait = deceitful } }
        			set_character_flag = goldsmith_steal
				}
			}
        	character_event = { id = MNM.9111 days = 50 random = 100 }
        	character_event = { id = MNM.9133 days = 20 random = 5 } #tombola for random events
        }
		ai_chance = {
    		factor = 33
    		modifier = {
    			OR = {
    				tier = KING	
    				tier = DUKE
				}
    			factor = 10
    		}
    		modifier = {
    			lower_tier_than = DUKE
    			factor = 3
    		}
    		modifier = {
    			tier = EMPEROR
    			factor = 3
    		}
    		modifier = {
    			NOR = {
    				wealth = 150
    				yearly_income = 25
    			}
    			factor = 0
    		}
    	}
    }
   
   	#I can't afford that much 
    option = {
        name = EVTOPTC_MNM_9103
        custom_tooltip = { text = EVTOPTC_MNM_9103_TT }

        wealth = -500

        hidden_effect = {
        	event_target:smith = { set_character_flag = cheap_jewels }
        	set_character_flag = cheap_jewels
        	random_list = {
				100 = { #Success
        			set_character_flag = goldsmith_success
				}
				10 = { #Steal
        			modifier = { factor = 1.3 FROM = { trait = envious } }
        			modifier = { factor = 0.2 FROM = { trait = charitable } }
        			modifier = { factor = 0.2 FROM = { trait = content } }
        			modifier = { factor = 1.5 FROM = { trait = ambitious } }
        			modifier = { factor = 1.3 FROM = { trait = deceitful } }
        			set_character_flag = goldsmith_steal
				}
			}
        	character_event = { id = MNM.9111 days = 50 random = 100 }
        	character_event = { id = MNM.9133 days = 20 random = 5 } #tombola for random events
        }

        ai_chance = {
    		factor = 33
    		modifier = {
    			tier = COUNT
    			factor = 10
				}
    		modifier = {
    			OR = {
    				tier = KING	
    				tier = DUKE
				}
    			factor = 3
			}
    		modifier = {
    			NOR = {
    				wealth = 25
    				yearly_income = 5
    				religion_group = pagan_group
				}
    			factor = 0
			}
    	}
    }

    #Actually, no
    option = {
        name = EVTOPTD_MNM_9103
        custom_tooltip = { text = EVTOPTD_MNM_9103_TT }

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

       	ai_chance = { factor = 15 }
    }
}	

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

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    immediate = {
    	if = {
    		limit = { NOT = { event_target:smith_employer = { is_alive = yes } } }
    		liege = { save_event_target_as = smith_employer }
    	}
    
    	trigger_switch = {
    		on_trigger = has_character_flag
    		expensive_jewels	= { event_target:smith_employer = { character_event = { id = MNM.9105 } } }
    		good_jewels			= { event_target:smith_employer = { character_event = { id = MNM.9106 } } }
    		cheap_jewels		= { event_target:smith_employer = { character_event = { id = MNM.9107 } } }
		}
    }
}

#Amazing crown jewels
character_event = {
    id = MNM.9105
    picture = GFX_evt_treasure_chamber
    border = GFX_event_normal_frame_economy

     desc = {
    	trigger = { religion_group = christian }
    	text = EVTDESC_MNM_9105
    	picture = GFX_evt_holy_emperor
    }
    desc = {
    	trigger = { NOT = { religion_group = christian } }
    	text = EVTDESC_MNM_9105
    	picture = GFX_evt_treasure_chamber
    }

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    option = { 
        name = EVTOPTA_MNM_9105

        if = {
        	limit = { 
        		OR = {
        			religion_group = christian 
        			religion_group = jewish_group
				}
        	}
        	add_artifact = crown_of_majesty
        	add_artifact = emerald_scepter
        	add_artifact = sword_of_heroes
        }
        else_if = {
        	limit = { 
        		OR = {
        			religion_group = muslim 
        			religion = west_african_pagan
        			religion = west_african_pagan_reformed
        		}
        	}
        	add_artifact = dagger_of_glory
        	add_artifact = ruby_bracelets
        }
        else_if = {
        	limit = { 
        		OR = {
        			religion_group = indian_group
        			religion = bon
        		}
        	}
        	add_artifact = dagger_of_glory
        	add_artifact = celestial_necklace
        }
        else_if = {
        	limit = { 
        		OR = {
        			religion_group = zoroastrian_group
        			religion = zun_pagan
        			religion = zun_pagan_reformed
				}
			}
        	add_artifact = circlet_of_the_heavens
        	add_artifact = staff_of_majesty
        }
        else_if = {
        	limit = {
        		OR = {
        			religion = norse_pagan
        			religion = norse_pagan_reformed
        		}
        	}
        	add_artifact = crown_of_crows
        	add_artifact = sword_of_heroes
        }
        else = {
        	add_artifact = heros_crown
        	add_artifact = axe_of_the_ancestors
        }

        hidden_effect = { 
        	event_target:smith = { character_event = { id = MNM.9110 days = 5 } } 
        	clr_character_flag = expensive_jewels
			clr_character_flag = good_jewels
			clr_character_flag = cheap_jewels
        }
    }
}


#Good crown jewels
character_event = {
    id = MNM.9106
    picture = GFX_evt_treasure_chamber
    border = GFX_event_normal_frame_economy

    is_triggered_only = yes

    desc = {
    	trigger = { religion_group = christian }
    	text = EVTDESC_MNM_9106
    	picture = GFX_evt_holy_emperor
    }
    desc = {
    	trigger = { NOT = { religion_group = christian } }
    	text = EVTDESC_MNM_9106
    	picture = GFX_evt_treasure_chamber
    }
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    option = {
        name = EVTOPTA_MNM_9106

        if = {
        	limit = { 
        		OR = {
        			religion_group = christian 
        			religion_group = jewish_group
				}
        	}
        	add_artifact = crown_of_pearls
        	add_artifact = ruby_scepter
        	add_artifact = golden_sword
        }
        else_if = {
        	limit = { 
        		OR = {
        			religion_group = muslim 
        			religion = west_african_pagan
        			religion = west_african_pagan_reformed
        		}
        	}
        	add_artifact = bejeweled_dagger
        	add_artifact = golden_bracelets
        }
        else_if = {
        	limit = { 
        		OR = {
        			religion_group = indian_group
        			religion = bon
        		}
        	}
        	add_artifact = bejeweled_dagger
        	add_artifact = necklace_of_radiance
        }
        else_if = {
        	limit = { 
        		OR = {
        			religion_group = zoroastrian_group
        			religion = zun_pagan
        			religion = zun_pagan_reformed
				}
			}
        	add_artifact = circlet_of_the_heavens
        	add_artifact = golden_staff
        }
        else_if = {
        	limit = { 
        		OR = {
        			religion = norse_pagan
        			religion = norse_pagan_reformed
        		}
        	}
        	add_artifact = crown_of_the_sea
        	add_artifact = golden_sword
        }
        else = {
        	add_artifact = amber_crown
        	add_artifact = obsidian_axe
        }

        hidden_effect = { 
        	event_target:smith = { character_event = { id = MNM.9110 days = 5 } } 
        	clr_character_flag = expensive_jewels
			clr_character_flag = good_jewels
			clr_character_flag = cheap_jewels
        }
    }
}

#Okay crown jewels
character_event = {
    id = MNM.9107
    desc = EVTDESC_MNM_9107
    picture = GFX_evt_weaponsmith
    border = GFX_event_normal_frame_economy


    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    option = {
        name = EVTOPTA_MNM_9107

        if = {
        	limit = {
        		OR = {
        			religion_group = christian 
        			religion_group = jewish_group
				}
        	}
        	add_artifact = the_lily_crown
        	add_artifact = noble_scepter
        	add_artifact = engraved_sword
        }
        else_if = {
        	limit = {
        		OR = {
        			religion_group = muslim 
        			religion = west_african_pagan
        			religion = west_african_pagan_reformed
        		}
        	}
        	add_artifact = engraved_dagger
        	add_artifact = silver_bracelets
        }
        else_if = {
        	limit = { 
        		OR = {
        			religion_group = indian_group
        			religion = bon
        		}
        	}
        	add_artifact = engraved_dagger
        	add_artifact = collar_of_pearls
        }
        else_if = {
        	limit = { 
        		OR = {
        			religion_group = zoroastrian_group
        			religion = zun_pagan
        			religion = zun_pagan_reformed
				}
			}
        	add_artifact = circlet_of_twilight
        	add_artifact = silver_staff
        }
        else_if = {
        	limit = {
        		OR = {
        			religion = norse_pagan
        			religion = norse_pagan_reformed
        		}
        	}
        	add_artifact = iron_crown
        	add_artifact = engraved_sword
        }
        else = {
        	add_artifact = engraved_crown
        	add_artifact = ceremonial_axe
        }

        hidden_effect = { 
        	event_target:smith = { character_event = { id = MNM.9110 days = 5 } } 
        	clr_character_flag = expensive_jewels
			clr_character_flag = good_jewels
			clr_character_flag = cheap_jewels
        }
    }
}

#Ping event for problems 
character_event = {
	id = MNM.9108
    hide_window = yes

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    immediate = {
    	if = {
    		limit = { NOT = { event_target:smith_employer = { is_alive = yes } } }
    		liege = { save_event_target_as = smith_employer }
    	}

    	event_target:smith_employer = { character_event = { id = MNM.9109 } }
    }
}

#Problems
character_event = {
    id = MNM.9109
    desc = EVTDESC_MNM_9109
    picture = GFX_evt_merchant_caravan
    border = GFX_event_normal_frame_economy

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }
    
    #I want my expensive stuff
    option = {
    	trigger = { FROM  = { has_character_flag = expensive_jewels } }
        name = EVTOPTA_MNM_9109
        custom_tooltip = { text = EVTOPTA_MNM_9109_TT }

        scaled_wealth = { value = -3 min = -150 }
    }

    #Settle for less expensive stuff
    option = {
    	trigger = { FROM  = { has_character_flag = expensive_jewels } }
        name = EVTOPTB_MNM_9109
        custom_tooltip = { text = EVTOPTB_MNM_9109_TT }

        hidden_effect = {
        	FROM = {
	        	clr_character_flag = expensive_jewels
	        	set_character_flag = good_jewels
        	}
        	clr_character_flag = expensive_jewels
        	set_character_flag = good_jewels
    	}
    }

    #I want my good stuff
    option = {
    	trigger = { FROM  = { has_character_flag = good_jewels } }
        name = EVTOPTC_MNM_9109
        custom_tooltip = { text = EVTOPTC_MNM_9109_TT }

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

    #Settle for less good stuff
    option = {
    	trigger = { FROM  = { has_character_flag = good_jewels } }
        name = EVTOPTD_MNM_9109
        custom_tooltip = { text = EVTOPTD_MNM_9109_TT }

        hidden_effect = {
        	FROM = {
	        	clr_character_flag = good_jewels
	        	set_character_flag = cheap_jewels
			}
        	clr_character_flag = good_jewels
        	set_character_flag = cheap_jewels
        }
    }

    after = { 
    	hidden_effect = { 
    		clr_character_flag = goldsmith_fail
    		set_character_flag = goldsmith_success 
    		character_event = { id = MNM.9111 days = 50 random = 100 }
    	}
    }
}

character_event = {
	id = MNM.9110
	hide_window = yes

	is_triggered_only = yes
	
	trigger = {
		is_landed = no
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }
	
	immediate = {
		any_spouse = {
			limit = {
				dynasty = none
			}
			leave_court_and_die_effect = yes
		}
		leave_court_and_die_effect = yes
	}
}

#Ping event for checking if Goldsmith died
character_event = {
	id = MNM.9111
    hide_window = yes

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    	event_target:smith = { is_alive = yes }
    }

    fail_trigger_effect = { character_event = { id = MNM.9112 } }

    immediate = {
    	trigger_switch = {
    		on_trigger = has_character_flag
    		goldsmith_success = { event_target:smith = { character_event = { id = MNM.9104 } } }
    		goldsmith_fail = { event_target:smith = { character_event = { id = MNM.9108 } } }
    		goldsmith_steal = { event_target:smith = { character_event = { id = MNM.9131 } } }
		}
		clr_character_flag = goldsmith_success
		clr_character_flag = goldsmith_fail
		clr_character_flag = goldsmith_steal
    }
}

#Goldsmith died
character_event = {
    id = MNM.9112
    desc = EVTDESC_MNM_9112
    picture = GFX_evt_weaponsmith
    border = GFX_event_normal_frame_economy

    hide_from = yes
    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }
    
    #Returned leftover money
    option = {
    	trigger = { has_character_flag = expensive_jewels }
        name = EVTOPTA_MNM_9112

        scaled_wealth = { value = 3 min = 180 }
    }

    #Returned leftover money
    option = {
    	trigger = { has_character_flag = good_jewels }
        name = EVTOPTB_MNM_9112

        scaled_wealth = { value = 1.5 min = 90 }
    }

    #Returned leftover money
    option = {
    	trigger = { has_character_flag = cheap_jewels }
        name = EVTOPTC_MNM_9112

        scaled_wealth = { value = 0.5 min = 25 }
    }
    after = {
    	clr_character_flag = expensive_jewels
		clr_character_flag = good_jewels
		clr_character_flag = cheap_jewels
		clr_character_flag = goldsmith_success
		clr_character_flag = goldsmith_fail
		clr_character_flag = goldsmith_steal
    }
}

###WEAPON EVENTS###
character_event = {
    id = MNM.9115
    desc = EVTDESC_MNM_9115
    picture = GFX_evt_weaponsmith
    border = GFX_event_normal_frame_economy

    hide_from = yes
    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    immediate = { #Selecting gender of the weapon smith
    	hidden_effect = {
    		job_marshal = {
    			save_event_target_as = my_helpful_marshal
    		}
	    	random_list = {
				15 = { #Woman
					modifier = { factor = 2 primary_title = { has_law = status_of_women_2 } }
					modifier = { factor = 2 primary_title = { has_law = status_of_women_3 } }
					modifier = { factor = 2 primary_title = { has_law = status_of_women_4 } }
					modifier = { factor = 6 has_game_rule = { name = gender value = all } } 
					create_random_steward  = {
	        			age = 45
		        		random_traits = yes
		        		female = yes
		        		dynasty = none
		        		attributes = {
		        			stewardship = 3
		        		}
		        		historical = yes
		        	}
		        	new_character = { 
		        		save_event_target_as = smith
		        		set_character_flag = ai_flag_refuse_marriage
		        		set_character_flag = ai_flag_refuse_concubinage
		        		set_character_flag = cannot_marry
						will_not_marry_effect = yes
		        	}
				} 
				85 = { #Man
		        	create_random_steward  = {
		        		age = 45
		        		random_traits = yes
		        		female = no
		        		dynasty = none
		        		attributes = {
		        			stewardship = 3
		        		}
		        		historical = yes
					}
		        	new_character = {
		        		save_event_target_as = smith
		        		set_character_flag = ai_flag_refuse_marriage
		        		set_character_flag = cannot_marry
						will_not_marry_effect = yes
					}
				}
			}
			event_target:smith = {
				health = 3
        		ROOT = {
        			trigger_switch = {
	        			on_trigger = has_character_flag 
	        			weaponsmith = { PREV = { give_nickname = nick_the_weaponsmith } }
	        			armorsmith = { PREV = { give_nickname = nick_the_armorsmith } }
	        		}
        		}
        		random_list = { #Stewardship
        			15 = { change_stewardship = 1 }
        			25 = { change_stewardship = 3 }
        			20 = { change_stewardship = 5 }
        			10 = { change_stewardship = 7 }
        		}
        		random_list = { #Personality
        			1 = { add_trait = greedy }
        			1 = { add_trait = envious }
        			1 = { add_trait = charitable }
        			1 = { add_trait = diligent }
        			1 = { add_trait = deceitful }
        		}
        		random = {
        			chance = 30
        			modifier = {
        				factor = 2
        				trait = indulgent_wastrel
        			}
        			upgrade_education_effect = yes
        		}
			}
    	}

    	#Province for loc
    	random_province = { 
    		limit = { owner = { is_within_diplo_range = ROOT } }
    		save_event_target_as = neighbor_province
    	}
    	random_demesne_province = {
    		limit = { any_neighbor_province = { NOT = { owner = { character = ROOT } } } }
    		random_neighbor_province = {
    			limit = { NOT = { owner = { character = ROOT } } }
    			save_event_target_as = neighbor_province
    		}
    	}
    }

    #Yes, invite them!
    option = { 
        name = EVTOPTA_MNM_9115
        custom_tooltip = { text = EVTOPTA_MNM_9115_TT }
        event_target:my_helpful_marshal = {
        	show_portrait = yes
        }
        reverse_opinion = {
        	who = event_target:my_helpful_marshal
        	modifier = opinion_was_praised
        }
        hidden_effect = {
        	save_event_target_as = smith_employer
        	event_target:smith = { 
        		character_event = { id = MNM.9116 days = 7 } 
        	}
        }
    }

    #Don't invite them
    option = {
        name = EVTOPTB_MNM_9115
        custom_tooltip = { text = EVTOPTB_MNM_9115_TT }
        hidden_effect = {
        	event_target:smith = { 
        		leave_court_and_die_effect = yes
        	}
        }
        clr_character_flag = weaponsmith
        clr_character_flag = armorsmith
    }
}

#Ping event for weaponsmith
character_event = {
    id = MNM.9116
    hide_window = yes
    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    immediate = { event_target:smith_employer = { character_event = { id = MNM.9118 } } }
}

#What kind of weapon would you like?
character_event = {
    id = MNM.9118
    desc = EVTDESC_MNM_9118
    picture = GFX_evt_weaponsmith
    border = GFX_event_normal_frame_economy

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    #Sword
    option = { 
        trigger = { NOR = { religion_group = muslim has_dharmic_religion_trigger = yes } has_character_flag = weaponsmith }
        name = EVTOPTA_MNM_9118
        custom_tooltip = { text = EVTOPTA_MNM_9118_TT }
        hidden_tooltip = { FROM = { set_character_flag = weapon_sword } }
        ai_chance = { factor = 2 }
    }

    #Scimitar
    option = {
        trigger = { OR = { religion_group = muslim has_dharmic_religion_trigger = yes } has_character_flag = weaponsmith }
        name = EVTOPTB_MNM_9118
        custom_tooltip = { text = EVTOPTB_MNM_9118_TT }
        hidden_tooltip = { FROM = { set_character_flag = weapon_scimitar } }
        ai_chance = { factor = 2 }
    }
    
    #Lance
    option = {
    	trigger = { has_character_flag = weaponsmith }
        name = EVTOPTC_MNM_9118
        custom_tooltip = { text = EVTOPTC_MNM_9118_TT }
        hidden_tooltip = { FROM = { set_character_flag = weapon_lance } }
        ai_chance = { 
        	factor = 1 
        	modifier = { is_nomadic = yes factor = 2 }
        }
    }
    
    #Axe
    option = {
    	trigger = { has_character_flag = weaponsmith }
        name = EVTOPTD_MNM_9118
        custom_tooltip = { text = EVTOPTD_MNM_9118_TT }
        hidden_tooltip = { FROM = { set_character_flag = weapon_axe } }
        ai_chance = { 
        	factor = 1
        	modifier = { is_tribal = yes factor = 3 }
        }
    }

    #Mace
    option = {
        trigger = { is_nomadic = no has_character_flag = weaponsmith }
        name = EVTOPTE_MNM_9118
        custom_tooltip = { text = EVTOPTE_MNM_9118_TT }
        hidden_tooltip = { FROM = { set_character_flag = weapon_mace } }
        ai_chance = { 
        	factor = 1
        	modifier = { religion = norse_pagan factor = 5 }
        	modifier = { religion = norse_pagan_reformed factor = 5 }
        }
    }

    #Bow
    option = {
        trigger = { is_nomadic = yes has_character_flag = weaponsmith }
        name = EVTOPTF_MNM_9118
        custom_tooltip = { text = EVTOPTF_MNM_9118_TT }
        hidden_tooltip = { FROM = { set_character_flag = weapon_bow } }
        ai_chance = { factor = 5 }
    }

    #Armor
    option = {
    	trigger = { has_character_flag = armorsmith }
        name = EVTOPTG_MNM_9118
        custom_tooltip = { text = EVTOPTG_MNM_9118_TT }
        hidden_tooltip = { FROM = { set_character_flag = armor_set } }
    }

    after = {
        hidden_effect = { FROM = { character_event = { id = MNM.9119 days = 7 } } }
    }
}


#Ping event for weaponsmith
character_event = {
    id = MNM.9119
    hide_window = yes
    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    immediate = { event_target:smith_employer = { character_event = { id = MNM.9120 } } }
}


#And how much are you willing to pay?
character_event = {
    id = MNM.9120
    desc = EVTDESC_MNM_9120
    picture = GFX_evt_weaponsmith
    border = GFX_event_normal_frame_economy

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    #THe best money can buy
    option = { 
        name = EVTOPTA_MNM_9120
        trigger = { prestige = 2000 }
        tooltip_info = yes
        custom_tooltip = { text = available_due_to_prestige_tt }
       	if = {
            limit = { FROM = { has_character_flag = weapon_sword } }
            custom_tooltip = { text = EVTOPTA_MNM_9120_TT_SWORDSCIMITAR }
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_scimitar } }
            custom_tooltip = { text = EVTOPTA_MNM_9120_TT_SWORDSCIMITAR }
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_lance } }
           	custom_tooltip = { text = EVTOPTA_MNM_9120_TT_LANCE }
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_axe } }
            custom_tooltip = { text = EVTOPTA_MNM_9120_TT_AXE }
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_mace } }
            custom_tooltip = { text = EVTOPTA_MNM_9120_TT_MACE }
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_bow } }
            custom_tooltip = { text = EVTOPTA_MNM_9120_TT_BOW }
        }
        if = {
            limit = { FROM = { has_character_flag = armor_set } }
            custom_tooltip = { text = EVTOPTA_MNM_9120_TT_ARMOR }
        }

        wealth = -2400

        hidden_effect = {
        	event_target:smith = { set_character_flag = expensive_weapons }
        	set_character_flag = expensive_weapons
			random_list = {
				40 = { #Success
        			modifier = { factor = 0.7 FROM = { stewardship <= 2 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 4 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 6 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 8 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 10 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 10 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 12 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 14 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 16 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 18 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 20 } }
        			modifier = { factor = 1.3 FROM = { trait = greedy } }
        			modifier = { factor = 1.3 FROM = { trait = diligent } }
        			modifier = { factor = 1.3 FROM = { trait = patient } }
        			modifier = { factor = 1.3 FROM = { is_smart_trigger = yes } }
        			set_character_flag = smith_success
				}
				60 = { #Fail
					set_character_flag = smith_fail
				}
				10 = { #Steal
        			modifier = { factor = 1.3 FROM = { trait = envious } }
        			modifier = { factor = 0.2 FROM = { trait = charitable } }
        			modifier = { factor = 0.2 FROM = { trait = content } }
        			modifier = { factor = 1.5 FROM = { trait = ambitious } }
        			modifier = { factor = 1.3 FROM = { trait = deceitful } }
        			set_character_flag = smith_steal
				}
			}
        	character_event = { id = MNM.9125 days = 50 random = 100 }
        	character_event = { id = MNM.9133 days = 20 random = 5 } #tombola for random events
        }
    	ai_chance = {
    		factor = 33
    		modifier = {
    			tier = EMPEROR
    			factor = 10
    		}
    		modifier = {
    			OR = {
    				tier = KING	
    				tier = DUKE
    			}
    			factor = 3
    		}
    		modifier = {
    			NAND = {
    				wealth = 400
    				yearly_income = 40
    			}
    			factor = 0
    		}
    	}
    }

    #Something nice
    option = {
        name = EVTOPTB_MNM_9120
        if = {
            limit = { FROM = { has_character_flag = weapon_sword } }
            custom_tooltip = { text = EVTOPTB_MNM_9120_TT_SWORDSCIMITAR }
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_scimitar } }
            custom_tooltip = { text = EVTOPTB_MNM_9120_TT_SWORDSCIMITAR }
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_lance } }
           	custom_tooltip = { text = EVTOPTB_MNM_9120_TT_LANCE }
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_axe } }
            custom_tooltip = { text = EVTOPTB_MNM_9120_TT_AXE }
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_mace } }
            custom_tooltip = { text = EVTOPTB_MNM_9120_TT_MACE }
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_bow } }
            custom_tooltip = { text = EVTOPTB_MNM_9120_TT_BOW }
        }
        if = {
            limit = { FROM = { has_character_flag = armor_set } }
            custom_tooltip = { text = EVTOPTB_MNM_9120_TT_ARMOR }
        }

        wealth = -800

        hidden_effect = {
        	event_target:smith = { set_character_flag = good_weapons }
        	set_character_flag = good_weapons
			random_list = {
				60 = { #Success
        			modifier = { factor = 0.7 FROM = { stewardship <= 2 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 4 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 6 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 8 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 10 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 10 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 12 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 14 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 16 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 18 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 20 } }
        			modifier = { factor = 1.3 FROM = { trait = greedy } }
        			modifier = { factor = 1.3 FROM = { trait = diligent } }
        			modifier = { factor = 1.3 FROM = { trait = patient } }
        			modifier = { factor = 1.3 FROM = { is_smart_trigger = yes } }
        			set_character_flag = smith_success
				}
				40 = { #Fail
					set_character_flag = smith_fail
				}
				10 = { #Steal
        			modifier = { factor = 1.3 FROM = { trait = envious } }
        			modifier = { factor = 0.2 FROM = { trait = charitable } }
        			modifier = { factor = 0.2 FROM = { trait = content } }
        			modifier = { factor = 1.5 FROM = { trait = ambitious } }
        			modifier = { factor = 1.3 FROM = { trait = deceitful } }
        			set_character_flag = smith_steal
				}
			}
        	character_event = { id = MNM.9125 days = 50 random = 100 }
        	character_event = { id = MNM.9133 days = 20 random = 5 } #tombola for random events
        }
		ai_chance = {
    		factor = 33
    		modifier = {
    			OR = {
    				tier = KING	
    				tier = DUKE
    			}
    			factor = 10
    		}
    		modifier = {
    			lower_tier_than = DUKE
    			factor = 3
    		}
    		modifier = {
    			tier = EMPEROR
    			factor = 3
    		}
    		modifier = {
    			NAND = {
    				wealth = 180
    				yearly_income = 18
    			}
    			factor = 0
    		}
    	}
    }
   
   	#I can't afford that much 
    option = {
        name = EVTOPTC_MNM_9120
        if = {
            limit = { FROM = { NOT = { has_character_flag = armor_set } NOT = { has_character_flag = weapon_bow } } }
            custom_tooltip = { text = EVTOPTC_MNM_9120_TT_SWORDSCIMITAR }
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_bow } }
            custom_tooltip = { text = EVTOPTC_MNM_9120_TT_BOW }
        }
        if = {
            limit = { FROM = { has_character_flag = armor_set } }
            custom_tooltip = { text = EVTOPTC_MNM_9120_TT_ARMOR }
        }

        wealth = -400

        hidden_effect = {
        	event_target:smith = { set_character_flag = cheap_weapons }
        	set_character_flag = cheap_weapons
			random_list = {
				100 = { #Success
        			modifier = { factor = 0.7 FROM = { stewardship <= 2 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 4 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 6 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 8 } }
        			modifier = { factor = 0.7 FROM = { stewardship <= 10 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 10 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 12 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 14 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 16 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 18 } }
        			modifier = { factor = 1.1 FROM = { stewardship >= 20 } }
        			modifier = { factor = 1.3 FROM = { trait = greedy } }
        			modifier = { factor = 1.3 FROM = { trait = diligent } }
        			modifier = { factor = 1.3 FROM = { trait = patient } }
        			modifier = { factor = 1.3 FROM = { is_smart_trigger = yes } }
        			set_character_flag = smith_success
				}
				10 = { #Steal
        			modifier = { factor = 1.3 FROM = { trait = envious } }
        			modifier = { factor = 0.2 FROM = { trait = charitable } }
        			modifier = { factor = 0.2 FROM = { trait = content } }
        			modifier = { factor = 1.5 FROM = { trait = ambitious } }
        			modifier = { factor = 1.3 FROM = { trait = deceitful } }
        			set_character_flag = smith_steal
				}
			}
        	character_event = { id = MNM.9125 days = 50 random = 100 }
        	character_event = { id = MNM.9133 days = 20 random = 5 } #tombola for random events
        }

        ai_chance = {
    		factor = 33
    		modifier = {
    			tier = COUNT
    			factor = 10
    		}
    		modifier = {
    			OR = {
    				tier = KING	
    				tier = DUKE
    			}
    			factor = 3
    		}
    		modifier = {
    			NAND = {
    				wealth = 75
    				yearly_income = 7.5
    				religion_group = pagan_group
    			}
    			factor = 0
    		}
    	}
    }

    #Actually, no
    option = {
        name = EVTOPTD_MNM_9120
        custom_tooltip = { text = EVTOPTD_MNM_9120_TT }

       	ai_chance = { 
            factor = 15 
            modifier = {
                NOR = {
                    has_education_martial_trigger = yes
                    has_lifestyle_martial_trigger = yes
                }
                factor = 20
            }
        }
        clr_character_flag = weaponsmith
        clr_character_flag = armorsmith
        hidden_effect = { FROM = { character_event = { id = MNM.9110 days = 5 } } }
    }
}	

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

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    immediate = {
    	if = {
    		limit = { NOT = { event_target:smith_employer = { is_alive = yes } } }
    		liege = { save_event_target_as = smith_employer }
    	}

    	trigger_switch = {
    		on_trigger = has_character_flag
    		expensive_weapons		= { event_target:smith_employer = { character_event = { id = MNM.9122 } } }
    		good_weapons			= { event_target:smith_employer = { character_event = { id = MNM.9123 } } }
    		cheap_weapons			= { event_target:smith_employer = { character_event = { id = MNM.9124 } } }
    	}
    }
}

#Expensive weapon done
character_event = {
    id = MNM.9122
    picture = GFX_evt_weaponsmith
    border = GFX_event_normal_frame_economy

    is_triggered_only = yes
	
	desc = {
    	trigger = { FROM = { NOT = { has_character_flag = armor_set } } }
    	text = EVTDESC_MNM_9122
    }
	desc = {
    	trigger = { FROM = { has_character_flag = armor_set } }
    	text = EVTDESC_MNM_9122_B
    }
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    option = { 
        name = {
            text = EVTOPTA_MNM_9122_SWORD
            trigger = { FROM = { has_character_flag = weapon_sword } }
        } 
        name = {
            text = EVTOPTA_MNM_9122_SCIMITAR
            trigger = { FROM = { has_character_flag = weapon_scimitar } }
        } 
        name = {
            text = EVTOPTA_MNM_9122_LANCE
            trigger = { FROM = { has_character_flag = weapon_lance } }
        } 
        name = {
            text = EVTOPTA_MNM_9122_AXE
            trigger = { FROM = { has_character_flag = weapon_axe } }
        } 
        name = {
            text = EVTOPTA_MNM_9122_MACE
            trigger = { FROM = { has_character_flag = weapon_mace } }
        } 
        name = {
            text = EVTOPTA_MNM_9122_BOW
            trigger = { FROM = { has_character_flag = weapon_bow } }
        } 
        name = {
            text = EVTOPTA_MNM_9122_ARMOR
            trigger = { FROM = { has_character_flag = armor_set } }
        } 

        if = {
            limit = { FROM = { has_character_flag = weapon_sword } }
            add_artifact = sword_tier_3_heartseeker
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_scimitar } }
            add_artifact = scimitar_tier_3_golden
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_lance } }
            add_artifact = lance_tier_3_impaler
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_axe } }
            add_artifact = axe_tier_3_cleaver
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_mace } }
            add_artifact = mace_tier_3_foe_hammer
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_bow } }
            add_artifact = bow_tier_3_silent_wind
        }
        if = {
            limit = { FROM = { has_character_flag = armor_set } }
            add_artifact = armor_tier_3_guardian
        }
    }

    option = {
        name = {
            text = EVTOPTB_MNM_9122_SWORD
            trigger = { FROM = { has_character_flag = weapon_sword } }
        } 
        name = {
            text = EVTOPTB_MNM_9122_SCIMITAR
            trigger = { FROM = { has_character_flag = weapon_scimitar } }
        } 
        name = {
            text = EVTOPTB_MNM_9122_LANCE
            trigger = { FROM = { has_character_flag = weapon_lance } }
        } 
        name = {
            text = EVTOPTB_MNM_9122_AXE
            trigger = { FROM = { has_character_flag = weapon_axe } }
        } 
        name = {
            text = EVTOPTB_MNM_9122_MACE
            trigger = { FROM = { has_character_flag = weapon_mace } }
        } 
        name = {
            text = EVTOPTB_MNM_9122_BOW
            trigger = { FROM = { has_character_flag = weapon_bow } }
        }
        name = {
            text = EVTOPTB_MNM_9122_ARMOR
            trigger = { FROM = { has_character_flag = armor_set } }
        }

        if = {
            limit = { FROM = { has_character_flag = weapon_sword } }
            add_artifact = sword_tier_3_vengeance
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_scimitar } }
            add_artifact = scimitar_tier_3_fortune
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_lance } }
            add_artifact = lance_tier_3_trident
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_axe } }
            add_artifact = axe_tier_3_ravager
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_mace } }
            add_artifact = mace_tier_3_bone_breaker
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_bow } }
            add_artifact = bow_tier_3_lightning
        }
        if = {
            limit = { FROM = { has_character_flag = armor_set } }
            add_artifact = armor_tier_3_champion
        }
    }
    
    option = {
        name = {
            text = EVTOPTC_MNM_9122_SWORD
            trigger = { FROM = { has_character_flag = weapon_sword } }
        } 
        name = {
            text = EVTOPTC_MNM_9122_SCIMITAR
            trigger = { FROM = { has_character_flag = weapon_scimitar } }
        } 
        name = {
            text = EVTOPTC_MNM_9122_LANCE
            trigger = { FROM = { has_character_flag = weapon_lance } }
        } 
        name = {
            text = EVTOPTC_MNM_9122_AXE
            trigger = { FROM = { has_character_flag = weapon_axe } }
        } 
        name = {
            text = EVTOPTC_MNM_9122_MACE
            trigger = { FROM = { has_character_flag = weapon_mace } }
        } 
        name = {
            text = EVTOPTC_MNM_9122_BOW
            trigger = { FROM = { has_character_flag = weapon_bow } }
        }
        name = {
            text = EVTOPTC_MNM_9122_ARMOR
            trigger = { FROM = { has_character_flag = armor_set } }
        }

        if = {
            limit = { FROM = { has_character_flag = weapon_sword } }
            add_artifact = sword_tier_3_fury
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_scimitar } }
            add_artifact = scimitar_tier_3_conquest
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_lance } }
            add_artifact = lance_tier_3_piercer
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_axe } }
            add_artifact = axe_tier_3_marauder
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_mace } }
            add_artifact = mace_tier_3_shatterer
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_bow } }
            add_artifact = bow_tier_3_eagle
        }
        if = {
            limit = { FROM = { has_character_flag = armor_set } }
            add_artifact = armor_tier_3_warden
        }
    }
    after = {
    	hidden_effect = { FROM = { character_event = { id = MNM.9127 days = 5 } } }
    	clr_character_flag = expensive_weapons
		clr_character_flag = good_weapons
		clr_character_flag = cheap_weapons
		clr_character_flag = weaponsmith
        clr_character_flag = armorsmith
    }
}

#Good weapon done
character_event = {
    id = MNM.9123
    desc = EVTDESC_MNM_9123
    picture = GFX_evt_weaponsmith
    border = GFX_event_normal_frame_economy

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    option = { 
        name = EVTOPTA_MNM_9123

        if = {
            limit = { FROM = { has_character_flag = weapon_sword } }
            add_artifact = sword_tier_2
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_scimitar } }
            add_artifact = scimitar_tier_2
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_lance } }
            add_artifact = lance_tier_2
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_axe } }
            add_artifact = axe_tier_2
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_mace } }
            add_artifact = mace_tier_2
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_bow } }
            add_artifact = bow_tier_2
        }
        if = {
            limit = { FROM = { has_character_flag = armor_set } }
            add_artifact = armor_tier_2
        }
    }
    after = {
    	hidden_effect = { FROM = { character_event = { id = MNM.9127 days = 5 } } }
    	clr_character_flag = expensive_weapons
		clr_character_flag = good_weapons
		clr_character_flag = cheap_weapons
		clr_character_flag = weaponsmith
        clr_character_flag = armorsmith
    }
}


#Cheap weapon done
character_event = {
    id = MNM.9124
    desc = EVTDESC_MNM_9124
    picture = GFX_evt_weaponsmith
    border = GFX_event_normal_frame_economy

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    option = { 
        name = EVTOPTA_MNM_9124

        if = {
            limit = { FROM = { has_character_flag = weapon_sword } }
            add_artifact = sword_tier_1
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_scimitar } }
            add_artifact = scimitar_tier_1
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_lance } }
            add_artifact = lance_tier_1
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_axe } }
            add_artifact = axe_tier_1
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_mace } }
            add_artifact = mace_tier_1
        }
        if = {
            limit = { FROM = { has_character_flag = weapon_bow } }
            add_artifact = bow_tier_1
        }
        if = {
            limit = { FROM = { has_character_flag = armor_set } }
            add_artifact = armor_tier_1
        }
    }
    after = {
    	hidden_effect = { FROM = { character_event = { id = MNM.9127 days = 5 } } }
    	clr_character_flag = expensive_weapons
		clr_character_flag = good_weapons
		clr_character_flag = cheap_weapons
		clr_character_flag = weaponsmith
        clr_character_flag = armorsmith
    }
}

#Ping event for problems 
character_event = {
	id = MNM.9128
    hide_window = yes

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    immediate = {
    	if = {
    		limit = { NOT = { event_target:smith_employer = { is_alive = yes } } }
    		liege = { save_event_target_as = smith_employer }
    	}

    	event_target:smith_employer = { character_event = { id = MNM.9129 } }
    }
}

#Problems
character_event = {
    id = MNM.9129
    desc = EVTDESC_MNM_9129
    picture = GFX_evt_merchant_caravan
    border = GFX_event_normal_frame_economy

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }
    
    #I want my expensive stuff
    option = {
    	trigger = { FROM  = { has_character_flag = expensive_weapons } }
        name = EVTOPTA_MNM_9109
        custom_tooltip = { text = EVTOPTA_MNM_9129_TT }

        wealth = -1200
    }

    #Settle for less expensive stuff
    option = {
    	trigger = { FROM  = { has_character_flag = expensive_weapons } }
        name = EVTOPTB_MNM_9109
        custom_tooltip = { text = EVTOPTB_MNM_9129_TT }

        hidden_effect = {
        	FROM = {
	        	clr_character_flag = expensive_weapons
	        	set_character_flag = good_weapons
        	}
        	clr_character_flag = expensive_weapons
        	set_character_flag = good_weapons
    	}
    }

    #I want my good stuff
    option = {
    	trigger = { FROM  = { has_character_flag = good_weapons } }
        name = EVTOPTC_MNM_9109
        custom_tooltip = { text = EVTOPTA_MNM_9129_TT }

        wealth = -400
    }

    #Settle for less good stuff
    option = {
    	trigger = { FROM  = { has_character_flag = good_weapons } }
        name = EVTOPTD_MNM_9109
        custom_tooltip = { text = EVTOPTB_MNM_9129_TT }

        hidden_effect = {
        	FROM = {
	        	clr_character_flag = good_weapons
	        	set_character_flag = cheap_weapons
			}
        	clr_character_flag = good_weapons
        	set_character_flag = cheap_weapons
        }
    }

    after = { 
    	hidden_effect = { 
    		clr_character_flag = smith_fail
    		set_character_flag = smith_success 
    		character_event = { id = MNM.9125 days = 50 random = 100 }
    	}
    }
}

#Ping event for checking if Weaponsmith died
character_event = {
	id = MNM.9125
    hide_window = yes

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    	event_target:smith = { is_alive = yes }
    }

    fail_trigger_effect = { character_event = { id = MNM.9126 } }

    immediate = {
    	trigger_switch = {
    		on_trigger = has_character_flag
    		smith_success = { event_target:smith = { character_event = { id = MNM.9121 } } }
    		smith_fail = { event_target:smith = { character_event = { id = MNM.9128 } } }
    		smith_steal = { event_target:smith = { character_event = { id = MNM.9131 } } }
		}
		clr_character_flag = smith_success
		clr_character_flag = smith_fail
		clr_character_flag = smith_steal
    }
}

#Weaponsmith died
character_event = {
    id = MNM.9126
    desc = EVTDESC_MNM_9112
    picture = GFX_evt_weaponsmith
    border = GFX_event_normal_frame_economy

    hide_from = yes

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }
    
    #Returned leftover money
    option = {
    	trigger = { has_character_flag = expensive_weapons }
        name = EVTOPTA_MNM_9112

        scaled_wealth = { value = 3.5 min = 230 }
    }

    #Returned leftover money
    option = {
    	trigger = { has_character_flag = good_weapons }
        name = EVTOPTB_MNM_9112

        scaled_wealth = { value = 1.8 min = 100 }
    }

    #Returned leftover money
    option = {
    	trigger = { has_character_flag = cheap_weapons }
        name = EVTOPTC_MNM_9112

        scaled_wealth = { value = 0.8 min = 40 }
    }
    after = {
    	clr_character_flag = expensive_weapons
		clr_character_flag = good_weapons
		clr_character_flag = cheap_weapons
		clr_character_flag = weaponsmith
        clr_character_flag = armorsmith
		clr_character_flag = smith_success
		clr_character_flag = smith_fail
		clr_character_flag = smith_steal
    }
}

character_event = {
	id = MNM.9127
	hide_window = yes

	is_triggered_only = yes
	
	trigger = {
		is_landed = no
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }
	
	immediate = {
		any_spouse = {
			limit = {
				dynasty = none
			}
			leave_court_and_die_effect = yes
		}
		leave_court_and_die_effect = yes
	}
}

character_event = {
	id = MNM.9130
	desc = EVT_DESC_MNM_9130
    picture = GFX_evt_treasure_chamber
    border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	trigger = {
		OR = {
			has_dlc = "Mystics"
			has_dlc = "Jade Dragon"
		}
	}

	option = { #Weapon
		name = EVT_OPTA_MNM_9310
	    trigger = {
	    	NOT = { any_artifact = { has_artifact_flag = combat_weapon } }
	    	job_marshal = { always = yes }
	    }
	    custom_tooltip = {
	    	text = employ_a_smith_weapon_search_tt
	    	hidden_effect = {
	    		set_character_flag = weaponsmith
	    		character_event = { id = MNM.9115 days = 50 random = 50 }
	    	}
	   	}
	}
	option = { #Armor
		name = EVT_OPTB_MNM_9310
	    trigger = {
	    	NOT = { any_artifact = { has_artifact_flag = armor_set } }
	    	job_marshal = { always = yes }
	    }
	    custom_tooltip = {
	    	text = employ_a_smith_armor_search_tt
	    	hidden_effect = {
	    		set_character_flag = armorsmith
	    		character_event = { id = MNM.9115 days = 50 random = 50 }
	    	}
	   	}
	}
	option = { #Gold
		name = EVT_OPTC_MNM_9310
	    trigger = {
	    	NOT = { any_artifact = { has_artifact_flag = crown_jewel } }
	    }
	    custom_tooltip = {
	    	text = employ_a_smith_gold_search_tt
	    	hidden_effect = {
	    		character_event = { id = MNM.9100 days = 50 random = 50 }
	    	}
	   	}
	}
	option = {
		name = EVT_OPTD_MNM_9310
		custom_tooltip = {
			text = employ_smith_cd_reset_tt
			hidden_effect = {
				remove_character_modifier = employ_a_smith_cd
			}
		}
	}
}

#Smith steals item and decides who to give it to
character_event = {
	id = MNM.9131
	is_triggered_only = yes
	hide_window = yes

	trigger = {
		OR = {
			has_dlc = "Mystics"
			has_dlc = "Jade Dragon"
		}
	}

	immediate = {
		if = {
			limit = { NOT = { event_target:smith_employer = { is_alive = yes } } }
    		liege = { save_event_target_as = smith_employer }
		}
		trigger_switch = {
			on_trigger = has_character_flag
			expensive_jewels = { 
		        if = {
		        	limit = { 
		        		FROM = {
			        		OR = {
			        			religion_group = christian 
			        			religion_group = jewish_group
							}
						}
		        	}
		        	add_artifact = crown_of_majesty
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = emerald_scepter
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = sword_of_heroes
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else_if = {
		        	limit = { 
		        		FROM = {
			        		OR = {
			        			religion_group = muslim 
			        			religion = west_african_pagan
			        			religion = west_african_pagan_reformed
			        		}
			        	}
		        	}
		        	add_artifact = dagger_of_glory
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = ruby_bracelets
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else_if = {
		        	limit = { 
		        		FROM = {
			        		OR = {
			        			religion_group = indian_group
			        			religion = bon
			        		}
			        	}
		        	}
		        	add_artifact = dagger_of_glory
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = celestial_necklace
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else_if = {
		        	limit = { 
		        		FROM = {
			        		OR = {
			        			religion_group = zoroastrian_group
			        			religion = zun_pagan
			        			religion = zun_pagan_reformed
							}
						}
					}
		        	add_artifact = circlet_of_the_heavens
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = staff_of_majesty
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else_if = {
		        	limit = {
		        		FROM = {
			        		OR = {
			        			religion = norse_pagan
			        			religion = norse_pagan_reformed
			        		}
			        	}
		        	}
		        	add_artifact = crown_of_crows
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = sword_of_heroes
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else = {
		        	add_artifact = heros_crown
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = axe_of_the_ancestors
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
			}
			good_jewels = {  
				if = {
		        	limit = { 
		        		FROM = {
			        		OR = {
			        			religion_group = christian 
			        			religion_group = jewish_group
							}
						}
		        	}
		        	add_artifact = crown_of_pearls
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = ruby_scepter
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = golden_sword
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else_if = {
		        	limit = { 
		        		FROM = {
			        		OR = {
			        			religion_group = muslim 
			        			religion = west_african_pagan
			        			religion = west_african_pagan_reformed
			        		}
			        	}
		        	}
		        	add_artifact = bejeweled_dagger
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = golden_bracelets
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else_if = {
		        	limit = { 
		        		FROM = {
			        		OR = {
			        			religion_group = indian_group
			        			religion = bon
			        		}
			        	}
		        	}
		        	add_artifact = bejeweled_dagger
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = necklace_of_radiance
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else_if = {
		        	limit = { 
		        		FROM = {
			        		OR = {
			        			religion_group = zoroastrian_group
			        			religion = zun_pagan
			        			religion = zun_pagan_reformed
							}
						}
					}
		        	add_artifact = circlet_of_the_heavens
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = golden_staff
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else_if = {
		        	limit = { 
		        		FROM = {
			        		OR = {
			        			religion = norse_pagan
			        			religion = norse_pagan_reformed
			        		}
			        	}
		        	}
		        	add_artifact = crown_of_the_sea
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = golden_sword
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else = {
		        	add_artifact = amber_crown
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = obsidian_axe
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
			}
			cheap_jewels = { 
		        if = {
		        	limit = {
		        		FROM = {
			        		OR = {
			        			religion_group = christian 
			        			religion_group = jewish_group
							}
						}
		        	}
		        	add_artifact = the_lily_crown
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = noble_scepter
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = engraved_sword
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else_if = {
		        	limit = {
		        		FROM = {
			        		OR = {
			        			religion_group = muslim 
			        			religion = west_african_pagan
			        			religion = west_african_pagan_reformed
			        		}
			        	}
		        	}
		        	add_artifact = engraved_dagger
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = silver_bracelets
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else_if = {
		        	limit = { 
		        		FROM = {
			        		OR = {
			        			religion_group = indian_group
			        			religion = bon
			        		}
			        	}
		        	}
		        	add_artifact = engraved_dagger
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = collar_of_pearls
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else_if = {
		        	limit = { 
		        		FROM = {
			        		OR = {
			        			religion_group = zoroastrian_group
			        			religion = zun_pagan
			        			religion = zun_pagan_reformed
							}
						}
					}
		        	add_artifact = circlet_of_twilight
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = silver_staff
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else_if = {
		        	limit = {
		        		FROM = {
			        		OR = {
			        			religion = norse_pagan
			        			religion = norse_pagan_reformed
			        		}
			        	}
		        	}
		        	add_artifact = iron_crown
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = engraved_sword
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
		        else = {
		        	add_artifact = engraved_crown
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        	add_artifact = ceremonial_axe
		        	new_artifact = { set_artifact_flag = stolen_by_smith }
		        }
			}
			expensive_weapons = { 
				trigger_switch = {
					on_trigger = has_character_flag
			        weapon_sword = { 
			        	random_list = {
			        		1 = { add_artifact = sword_tier_3_heartseeker }
			        		1 = { add_artifact = sword_tier_3_vengeance }
			        		1 = { add_artifact = sword_tier_3_fury }
			        	}
		        		new_artifact = { set_artifact_flag = stolen_by_smith }
			        }
			        weapon_scimitar = { 
			        	random_list = {
			        		1 = { add_artifact = scimitar_tier_3_golden }
			        		1 = { add_artifact = scimitar_tier_3_fortune }
			        		1 = { add_artifact = scimitar_tier_3_conquest }
			        	}
		        		new_artifact = { set_artifact_flag = stolen_by_smith }
			        }
			        weapon_lance = { 
			        	random_list = {
			        		1 = { add_artifact = lance_tier_3_impaler }
			        		1 = { add_artifact = lance_tier_3_trident }
			        		1 = { add_artifact = lance_tier_3_piercer }
			        	}
		        		new_artifact = { set_artifact_flag = stolen_by_smith }
			        }
			        weapon_axe = { 
			        	random_list = {
			        		1 = { add_artifact = axe_tier_3_cleaver }
			        		1 = { add_artifact = axe_tier_3_ravager }
			        		1 = { add_artifact = axe_tier_3_marauder }
			        	}
		        		new_artifact = { set_artifact_flag = stolen_by_smith }
			        }
			        weapon_mace = { 
			        	random_list = {
			        		1 = { add_artifact = mace_tier_3_foe_hammer }
			        		1 = { add_artifact = mace_tier_3_bone_breaker }
			        		1 = { add_artifact = mace_tier_3_shatterer }
			        	}
		        		new_artifact = { set_artifact_flag = stolen_by_smith }
			        }
			        weapon_bow = { 
			        	random_list = {
			        		1 = { add_artifact = bow_tier_3_silent_wind }
			        		1 = { add_artifact = bow_tier_3_lightning }
			        		1 = { add_artifact = bow_tier_3_eagle }
			        	}
		        		new_artifact = { set_artifact_flag = stolen_by_smith }
			        }
			        armor_set = { 
			        	random_list = {
			        		1 = { add_artifact = armor_tier_3_guardian }
			        		1 = { add_artifact = armor_tier_3_champion }
			        		1 = { add_artifact = armor_tier_3_warden }
			        	}
		        		new_artifact = { set_artifact_flag = stolen_by_smith }
			        }
			    }
			}
			good_weapons = { 
				trigger_switch = {
					on_trigger = has_character_flag
			        weapon_sword = { add_artifact = sword_tier_2 new_artifact = { set_artifact_flag = stolen_by_smith } }
			        weapon_scimitar = { add_artifact = scimitar_tier_2 new_artifact = { set_artifact_flag = stolen_by_smith } }
			        weapon_lance = { add_artifact = lance_tier_2 new_artifact = { set_artifact_flag = stolen_by_smith } }
			        weapon_axe = { add_artifact = axe_tier_2 new_artifact = { set_artifact_flag = stolen_by_smith } }
			        weapon_mace = { add_artifact = mace_tier_2 new_artifact = { set_artifact_flag = stolen_by_smith } }
			        weapon_bow = { add_artifact = bow_tier_2 new_artifact = { set_artifact_flag = stolen_by_smith } }
			        armor_set = { add_artifact = armor_tier_2 new_artifact = { set_artifact_flag = stolen_by_smith } }
			    }
			}
			cheap_weapons = { 
				trigger_switch = {
					on_trigger = has_character_flag
			        weapon_sword = { add_artifact = sword_tier_1 new_artifact = { set_artifact_flag = stolen_by_smith } }
			        weapon_scimitar = { add_artifact = scimitar_tier_1 new_artifact = { set_artifact_flag = stolen_by_smith } }
			        weapon_lance = { add_artifact = lance_tier_1 new_artifact = { set_artifact_flag = stolen_by_smith } }
			        weapon_axe = { add_artifact = axe_tier_1 new_artifact = { set_artifact_flag = stolen_by_smith } }
			        weapon_mace = { add_artifact = mace_tier_1 new_artifact = { set_artifact_flag = stolen_by_smith } }
			        weapon_bow = { add_artifact = bow_tier_1 new_artifact = { set_artifact_flag = stolen_by_smith } }
			        armor_set = { add_artifact = armor_tier_1 new_artifact = { set_artifact_flag = stolen_by_smith } }
			    }
			}
		}
		#Give to landed rivals first, then rivals, then nearby rulers who dislike the employer, else keep for self and run away
		if = {
			limit = { 
				event_target:smith_employer = { 
					any_rival = {
						is_landed = yes
						is_within_diplo_range = ROOT
					}
				}
			}
			event_target:smith_employer = { 
				random_rival = {
					limit = { 
						is_landed = yes
						is_within_diplo_range = ROOT
					}
					save_event_target_as = smith_steal_target
				}
			}
		}
		else_if = {
			limit = { 
				event_target:smith_employer = { 
					any_rival = {
						is_within_diplo_range = ROOT
					}
				}
			}
			event_target:smith_employer = { 
				random_rival = {
					limit = { 
						is_within_diplo_range = ROOT
					}
					save_event_target_as = smith_steal_target
				}
			}
		}
		else_if = {
			limit = { 
				event_target:smith_employer = { 
					any_neighbor_independent_ruler = {
						NOT = {
							opinion = {
								who = PREV
								value = -30
							}
						}
					}
				}
			}
			event_target:smith_employer = { 
				any_neighbor_independent_ruler = {
					limit = {
						NOT = {
							opinion = {
								who = PREV
								value = -30
							}
						}
					}
					save_event_target_as = smith_steal_target
				}
			}
		}
		else_if = {
			limit = { 
				event_target:smith_employer = { 
					any_neighbor_independent_ruler = {
						NOT = {
							opinion = {
								who = PREV
								value = 0
							}
						}
					}
				}
			}
			event_target:smith_employer = { 
				any_neighbor_independent_ruler = {
					limit = {
						NOT = {
							opinion = {
								who = PREV
								value = 0
							}
						}
					}
					save_event_target_as = smith_steal_target
				}
			}
		}
		else = { save_event_target_as = smith_steal_target }
		any_artifact = {
			limit = { has_artifact_flag = stolen_by_smith }
			set_original_owner = event_target:smith_employer
			transfer_artifact = {
				to = event_target:smith_steal_target
				from = ROOT
			}
		}
		if = {
			limit = { 
				event_target:smith_steal_target = { is_landed = yes }
				is_landed = no
			}
			move_character = event_target:smith_steal_target
			opinion = {
				who = event_target:smith_steal_target
				modifier = opinion_grateful
				years = 10
			}
			reverse_opinion = {
				who = event_target:smith_steal_target
				modifier = opinion_grateful
				years = 10
			}
		}
		else = { banish = yes }
		event_target:smith_employer = { character_event = { id = MNM.9132 } }
		#clear_event_target = smith_employer
    	clr_character_flag = expensive_weapons
		clr_character_flag = good_weapons
		clr_character_flag = cheap_weapons
		clr_character_flag = expensive_jewels
		clr_character_flag = good_jewels
		clr_character_flag = cheap_jewels
	}
}

character_event = {
	id = MNM.9132
	desc = EVT_DESC_MNM_9132
    picture = GFX_evt_merchant_caravan
    border = GFX_event_normal_frame_economy

    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    }

    option = {
    	name = EVT_OPTA_MNM_9132
    	event_target:smith_steal_target = {
    		show_scope_change = no
    		any_artifact = {
    			limit = { has_artifact_flag = stolen_by_smith }
    			clr_artifact_flag = stolen_by_smith
    			tooltip = { 
    				transfer_artifact = {
    					to = event_target:smith_steal_target
    					from = ROOT
    				}
    			}
    		}
			reverse_opinion = {
				who = ROOT
				modifier = opinion_thief
				years = 10
			}
    	}
    	FROM = {
    		show_scope_change = no
			reverse_opinion = {
				who = ROOT
				modifier = opinion_thief
				years = 10
			}
			hidden_effect = { remove_nickname = yes }
		}
    }
}

#Tombola for events mid-smithing
character_event = {
	id = MNM.9133
	hide_window = yes
    is_triggered_only = yes
    
    trigger = {
    	OR = {
    		has_dlc = "Mystics"
    		has_dlc = "Jade Dragon"
    	}
    	event_target:smith = { is_alive = yes }
    }

    fail_trigger_effect = { 
    	if = {
    		limit = {
    			OR = {
    				has_character_flag = weaponsmith
					has_character_flag = armorsmith
    			}
    		}
    		character_event = { id = MNM.9126 }
    	}
    	else = {
    		character_event = { id = MNM.9112 }
    	}
    	clear_delayed_event = { id = MNM.9111 }
    	clear_delayed_event = { id = MNM.9125 }
    }
	
	immediate = {
		event_target:smith = { 
			random_list = { #Set flag then ping event
				20 = { #Smith teachs someone stewardship
					trigger = {
						ROOT = { 
							OR = {
								any_courtier = {
									age = 13
									stewardship < 14
									NOT = { character = PREVPREV }
								}
								any_friend = {
									liege = { character = ROOT }
									age = 13
									stewardship < 14
									NOT = { character = PREVPREV }
								}
								any_child = {
									liege = { character = ROOT }
									age = 13
									stewardship < 14
									NOT = { character = PREVPREV }
								}
							}
						}
					}
					modifier = {
						factor = 1.5
						ROOT = {
							NOR = {
								has_character_flag = weaponsmith
								has_character_flag = armorsmith
							}
						}
					}
					set_character_flag = smith_event_MNM_9135
					character_event = { id = MNM.9134 }
				}
				20 = { #Smith makes child/ward stronger
					trigger = {
						ROOT = { 
							OR = {
								any_child = {
									liege = { character = ROOT }
									age <= 16
									is_strong_trigger = no
									NOT = { trait = weak }
								}
								any_pupil = {
									age <= 16
									is_strong_trigger = no
									NOT = { trait = weak }
								}
							}
						}
					}
					modifier = {
						factor = 1.5
						ROOT = {
							OR = {
								has_character_flag = weaponsmith
								has_character_flag = armorsmith
							}
						}
					}
					set_character_flag = smith_event_MNM_9136
					character_event = { id = MNM.9134 }
				}
				15 = { #Smith sleeps with courtier
					trigger = {
						ROOT = {
							any_courtier = {
								age = 16
								OR = {
									AND = {
										event_target:smith = { is_female = yes }
										prefers_men_trigger = no
									}
									AND = {
										event_target:smith = { is_female = no }
										prefers_men_trigger = yes
									}
								}
							}
						}
						NOR = {
							trait = chaste
							trait = celibate
						}
					}
					modifier = {
						factor = 2
						trait = lustful
					}
					modifier = {
						factor = 2
						trait = hedonist
					}
					modifier = {
						factor = 2
						OR = {
							trait = seducer
							trait = seductress
						}
					}
					set_character_flag = smith_event_MNM_9137
					character_event = { id = MNM.9134 }
				}
				15 = { #Smith has an accident
					modifier = {
						factor = 5
						is_dumb_trigger = yes
					}
					modifier = { factor = 0 }
					set_character_flag = smith_event_MNM_9138
					character_event = { id = MNM.9134 }
				}
				30 = { }
			}
		}
	}
}

#Ping the smith
character_event = {
	id = MNM.9134
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		trigger_switch = {
			on_trigger = has_character_flag
			smith_event_MNM_9135 = { FROM = { character_event = { id = MNM.9135 } } }
			smith_event_MNM_9136 = { FROM = { character_event = { id = MNM.9136 } } }
			smith_event_MNM_9137 = { FROM = { character_event = { id = MNM.9137 } } }
			smith_event_MNM_9138 = { FROM = { character_event = { id = MNM.9138 } } }
		}
		clr_character_flag = smith_event_MNM_9135
		clr_character_flag = smith_event_MNM_9136
		clr_character_flag = smith_event_MNM_9137
		clr_character_flag = smith_event_MNM_9138
	}
}

#Smith teaches someone stewardship
character_event = {
	id = MNM.9135
	desc = EVT_DESC_MNM_9135
    picture = GFX_evt_weaponsmith
    border = GFX_event_normal_frame_economy

	is_triggered_only = yes

	immediate = {
		random_courtier = {
			limit = { 
				age = 13
				stewardship < 14
				NOT = { character = FROM }
			}
			save_event_target_as = smith_event_target
		}
		random_friend = {
			limit = { 
				liege = { character = ROOT }
				age = 13
				stewardship < 14
				NOT = { character = FROM }
			}
			save_event_target_as = smith_event_target
		}
		random_child = {
			limit = { 
				liege = { character = ROOT }
				age = 13
				stewardship < 14
			}
			save_event_target_as = smith_event_target
		}
	}

	option = {
		name = EVT_OPTA_MNM_9135
		prestige = -50
		event_target:smith_event_target = {
			change_stewardship = 1
			opinion = {
				who = ROOT
				modifier = opinion_happy
				months = 12
			}
		}
		FROM = {
			show_scope_change = no
			reverse_opinion = {
				who = event_target:smith_event_target
				modifier = opinion_grateful
				months = 12
			}
			reverse_opinion = {
				who = ROOT
				modifier = opinion_grateful
				months = 12
			}
		}
	}

	option = {
		name = EVT_OPTB_MNM_9135
		event_target:smith_event_target = { 
			show_scope_change = no
			opinion = {
				who = ROOT
				modifier = opinion_disappointed
				months = 12
			}
		}
		reverse_opinion = {
			who = FROM
			modifier = opinion_upset
			months = 12
		}
		if = {
			limit = { 
				OR = {
					AND = {# has weapon/armor smith not max tier
						OR = {
							has_character_flag = weaponsmith
							has_character_flag = armorsmith
						}
						NOT = { has_character_flag = expensive_weapons }
					}
					AND = {# or has goldsmith not max tier
						NOR = {
							has_character_flag = weaponsmith
							has_character_flag = armorsmith
						}
						NOT = { has_character_flag = expensive_jewels }
					}
				}
			}
			prestige = 50
			random = {
				chance = 10
				modifier = {
					factor = 0.5
					OR = {
						has_character_flag = good_weapons
						has_character_flag = good_jewels
					}
				}
				custom_tooltip = {
					text = smith_improves_quality_tt
					if = {
						limit = {
							OR = {
								has_character_flag = weaponsmith
								has_character_flag = armorsmith
							}
						}
						trigger_switch = {
							on_trigger = has_character_flag
							cheap_weapons = { 
								clr_character_flag = cheap_weapons set_character_flag = good_weapons 
								FROM = { clr_character_flag = cheap_weapons set_character_flag = good_weapons }
							}
							good_weapons = {
								clr_character_flag = good_weapons set_character_flag = expensive_weapons
								FROM = { clr_character_flag = good_weapons set_character_flag = expensive_weapons }
							}
						}
					}
					else = {
						trigger_switch = {
							on_trigger = has_character_flag
							cheap_jewels = { 
								clr_character_flag = cheap_jewels set_character_flag = good_jewels
								FROM = { clr_character_flag = cheap_jewels set_character_flag = good_jewels }
							}
							good_jewels = {
								clr_character_flag = good_jewels set_character_flag = expensive_jewels
								FROM = { clr_character_flag = good_jewels set_character_flag = expensive_jewels }
							}
						}
					}
				}
			}
		}
		else = {
			prestige = 75
		}
	}
}

#Smith makes ward stronger
character_event = {
	id = MNM.9136
	desc = EVT_DESC_MNM_9136
    picture = GFX_evt_weaponsmith
    border = GFX_event_normal_frame_war

	is_triggered_only = yes

	immediate = {
		random_child = {
			limit = { 
				liege = { character = ROOT }
				age <= 16
				is_strong_trigger = no
				NOT = { trait = weak }
			}
			save_event_target_as = smith_event_target
		}
		random_pupil = {
			limit = {
				age <= 16
				is_strong_trigger = no
				NOT = { trait = weak }
			}
			save_event_target_as = smith_event_target
		}
	}

	option = {
		name = EVT_OPTA_MNM_9136
		prestige = -50
		event_target:smith_event_target = { 
			show_scope_change = no
			if = {
				limit = { trait = feeble }
				remove_trait = feeble
			}
			else = { add_trait = robust }
			opinion = {
				who = ROOT
				modifier = opinion_happy
				months = 12
			}
		}
		FROM = {
			show_scope_change = no
			reverse_opinion = {
				who = event_target:smith_event_target
				modifier = opinion_grateful
				months = 12
			}
			reverse_opinion = {
				who = ROOT
				modifier = opinion_grateful
				months = 12
			}
		}
	}

	option = {
		name = EVT_OPTB_MNM_9136
		event_target:smith_event_target = {
			show_scope_change = no
			opinion = {
				who = ROOT
				modifier = opinion_disappointed
				months = 12
			}
		}
		reverse_opinion = {
			who = FROM
			modifier = opinion_upset
			months = 12
		}
		if = {
			limit = { 
				OR = {
					AND = { #has weapon/armor smith not max tier
						OR = {
							has_character_flag = weaponsmith
							has_character_flag = armorsmith
						}
						NOT = { has_character_flag = expensive_weapons }
					}
					AND = { #or has goldsmith not max tier
						NOR = {
							has_character_flag = weaponsmith
							has_character_flag = armorsmith
						}
						NOT = { has_character_flag = expensive_jewels }
					}
				}
			}
			prestige = 50
			random = {
				chance = 10
				modifier = {
					factor = 0.5
					OR = {
						has_character_flag = good_weapons
						has_character_flag = good_jewels
					}
				}
				custom_tooltip = {
					text = smith_improves_quality_tt
					if = {
						limit = {
							OR = {
								has_character_flag = weaponsmith
								has_character_flag = armorsmith
							}
						}
						trigger_switch = {
							on_trigger = has_character_flag
							cheap_weapons = { 
								clr_character_flag = cheap_weapons set_character_flag = good_weapons 
								FROM = { clr_character_flag = cheap_weapons set_character_flag = good_weapons }
							}
							good_weapons = {
								clr_character_flag = good_weapons set_character_flag = expensive_weapons
								FROM = { clr_character_flag = good_weapons set_character_flag = expensive_weapons }
							}
						}
					}
					else = {
						trigger_switch = {
							on_trigger = has_character_flag
							cheap_jewels = { 
								clr_character_flag = cheap_jewels set_character_flag = good_jewels
								FROM = { clr_character_flag = cheap_jewels set_character_flag = good_jewels }
							}
							good_jewels = {
								clr_character_flag = good_jewels set_character_flag = expensive_jewels
								FROM = { clr_character_flag = good_jewels set_character_flag = expensive_jewels }
							}
						}
					}
				}
			}
		}
		else = {
			prestige = 75
		}
	}
}

#Smith sleeps with courtier
character_event = {
	id = MNM.9137
	desc = EVT_DESC_MNM_9137
    picture = GFX_evt_weaponsmith
    border = GFX_event_normal_frame_war

	is_triggered_only = yes

	immediate = {
		random_courtier = {
			limit = {
				age = 16
				OR = {
					AND = {
						event_target:smith = { is_female = yes }
						prefers_men_trigger = no
					}
					AND = {
						event_target:smith = { is_female = no }
						prefers_men_trigger = yes
					}
				}
			}
			save_event_target_as = smith_event_target
			save_event_target_as = sex_partner
		}
		FROM = { unprotected_sex_effect_event_target = yes }
	}

	option = { #Not my business
		name = EVT_OPTA_MNM_9137
		prestige = -75
	}

	option = { #Helll no
		name = EVT_OPTB_MNM_9137
		event_target:smith_event_target = { 
			show_scope_change = no
			opinion = {
				who = ROOT
				modifier = opinion_upset
				months = 12
			}
		}
		opinion = {
			who = FROM
			modifier = opinion_angry
			months = 12
		}
		reverse_opinion = {
			who = FROM
			modifier = opinion_worried
			months = 12
		}
		prestige = 25
	}

	option = { #Get out of my court
		name = EVT_OPTC_MNM_9137
		hidden_effect = {
    		clear_delayed_event = { id = MNM.9111 }
    		clear_delayed_event = { id = MNM.9125 }
	    	clr_character_flag = expensive_weapons
			clr_character_flag = good_weapons
			clr_character_flag = cheap_weapons
			clr_character_flag = weaponsmith
	        clr_character_flag = armorsmith
			clr_character_flag = smith_success
			clr_character_flag = smith_fail
			clr_character_flag = smith_steal
	    	clr_character_flag = expensive_jewels
			clr_character_flag = good_jewels
			clr_character_flag = cheap_jewels
			clr_character_flag = goldsmith_success
			clr_character_flag = goldsmith_fail
			clr_character_flag = goldsmith_steal
			FROM = {
		    	clr_character_flag = expensive_weapons
				clr_character_flag = good_weapons
				clr_character_flag = cheap_weapons
		    	clr_character_flag = expensive_jewels
				clr_character_flag = good_jewels
				clr_character_flag = cheap_jewels
				remove_nickname = yes
			}
    	}
    	prestige = 100
    	FROM = { 
    		show_scope_change = no
    		banish = yes
			opinion = {
				who = ROOT
				modifier = opinion_angry
				months = 12
			}
    	}
		reverse_opinion = {
			who = event_target:smith_event_target
			modifier = opinion_angry
			months = 12
		}
    	random = {
    		chance = 30
    		modifier = {
    			factor = 0
    			event_target:smith_event_target = { any_spouse = { ai = no } }
    		}
    		custom_tooltip = { 
    			text = smith_lover_elopes_tt
    			event_target:smith = {
    				liege = {
    					event_target:smith_event_target = {
							if = { 
								limit = { is_landed = no }
								move_character = PREV
							}
    						remove_spouse = spouse
    						add_spouse = event_target:smith
    					}
    				}
    			}
    		}
    	}
	}

	option = { #Off with his head
		name = EVT_OPTD_MNM_9137
		hidden_effect = {
    		clear_delayed_event = { id = MNM.9111 }
    		clear_delayed_event = { id = MNM.9125 }
	    	clr_character_flag = expensive_weapons
			clr_character_flag = good_weapons
			clr_character_flag = cheap_weapons
			clr_character_flag = weaponsmith
	        clr_character_flag = armorsmith
			clr_character_flag = smith_success
			clr_character_flag = smith_fail
			clr_character_flag = smith_steal
	    	clr_character_flag = expensive_jewels
			clr_character_flag = good_jewels
			clr_character_flag = cheap_jewels
			clr_character_flag = goldsmith_success
			clr_character_flag = goldsmith_fail
			clr_character_flag = goldsmith_steal
			FROM = {
				remove_nickname = yes
			}
    	}
    	prestige = 100
    	FROM = { death = { death_reason = death_execution killer = ROOT } }
		reverse_opinion = {
			who = event_target:smith_event_target
			modifier = opinion_angry
			months = 12
		}
	}
}

#Smith injured in accident
character_event = {
	id = MNM.9138
	desc = EVT_DESC_MNM_9138
    picture = GFX_evt_weaponsmith
    border = GFX_event_normal_frame_economy

    is_triggered_only = yes

    option = {
    	name = EVT_OPTA_MNM_9318
    	scaled_wealth = { value = -0.2 min = -30 max = -100 }
    	FROM = {
    		show_scope_change = no
    		random_list = {
    			1 = { add_maimed_trait_effect = yes }
    			2 = { 
    				trigger = { NOT = { trait = wounded } }
    				add_trait = wounded
    			}
    		}
			add_character_modifier = {
				name = good_care
				duration = 365
			}
    	}
    }
    option = {
    	name = EVT_OPTB_MNM_9318
		hidden_effect = {
    		clear_delayed_event = { id = MNM.9111 }
    		clear_delayed_event = { id = MNM.9125 }
	    	clr_character_flag = expensive_weapons
			clr_character_flag = good_weapons
			clr_character_flag = cheap_weapons
			clr_character_flag = weaponsmith
	        clr_character_flag = armorsmith
			clr_character_flag = smith_success
			clr_character_flag = smith_fail
			clr_character_flag = smith_steal
	    	clr_character_flag = expensive_jewels
			clr_character_flag = good_jewels
			clr_character_flag = cheap_jewels
			clr_character_flag = goldsmith_success
			clr_character_flag = goldsmith_fail
			clr_character_flag = goldsmith_steal
			FROM = {
		    	clr_character_flag = expensive_weapons
				clr_character_flag = good_weapons
				clr_character_flag = cheap_weapons
		    	clr_character_flag = expensive_jewels
				clr_character_flag = good_jewels
				clr_character_flag = cheap_jewels
				remove_nickname = yes
			}
    	}
    	FROM = {
    		show_scope_change = no
    		random_list = {
    			1 = { add_maimed_trait_effect = yes }
    			2 = { 
    				trigger = { NOT = { trait = wounded } }
    				add_trait = wounded
    			}
    		}
    		banish = yes
    	}
    }
}

character_event = {
	id = MNM.9899
	hide_window = yes
	
	is_triggered_only = yes
	has_dlc = "Mystics"
	
	trigger = {
		FROM = { 
			always = yes
			is_capital = yes
			location = { is_capital = yes }
		}
	}
	
	immediate = {
		set_character_flag = looted_by_raiding_holding
		repeat_event = { id = MNM.9900 }
	}
}

character_event = {
	id = MNM.9900
    hide_window = yes
	
	is_triggered_only = yes
	has_dlc = "Mystics"

	trigger = {
		FROM = {
			is_capital = yes #capital holding
			location = { is_capital = yes } #of capital province
		}
	}
	
	immediate = {
		save_event_target_as = looter
		FROM = {
			location = {
				save_event_target_as = target_location
			}
		}
#		log = "Chance to lose an artifact on_action fired for the leader: [This.GetBestName] on the holding: [From.GetName]"
		FROM = {
			save_event_target_as = target_title
			holder_scope = {
				if = {
					limit = {
						OR = {
							character = ROOT
							is_liege_or_above = ROOT
						}
					}
					break = yes
				}
				#log = "Chance to lose an artifact on_action fired for the capital of [This.GetBestName]"
				if = {
					limit = {
						num_of_artifacts = 1
					}
					character_event = { id = MNM.9901 } # Chance to lose an artifact.
				}
				any_courtier = {
					limit = {
						num_of_artifacts = 1
						at_location = event_target:target_location
						prisoner = no
					}
					character_event = { id = MNM.9901 } # Chance to lose an artifact.
				}
			}
		}
	}
}

character_event = {
	id = MNM.9901
	
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		save_event_target_as = original_item_owner
		random_list = {
			100 = {
				modifier = {
					factor = 0
					NOT = {
						any_artifact = {
							quality == 1
							NOT = {
								artifact_type_owned_by = FROM
							}
						}
					}
				}
				FROM = {
					character_event = { id = MNM.9902 }
				}
			}
			70 = {
				modifier = {
					factor = 0
					NOT = {
						any_artifact = {
							quality == 2
							NOT = {
								artifact_type_owned_by = FROM
							}
						}
					}
				}
				FROM = {
					character_event = { id = MNM.9904 }
				}
			}
			45 = {
				modifier = {
					factor = 0
					NOT = {
						any_artifact = {
							quality == 3
						}
					}
				}
				FROM = {
					character_event = { id = MNM.9906 }
				}
			}
			25 = {
				modifier = {
					factor = 0
					NOT = {
						any_artifact = {
							quality == 4
						}
					}
				}
				FROM = {
					character_event = { id = MNM.9908 }
				}
			}
			10 = {
				modifier = {
					factor = 0
					NOT = {
						any_artifact = {
							quality == 5
						}
					}
				}
				FROM = {
					character_event = { id = MNM.9910 }
				}
			}
			
			6000 = { #chance of no artifact stealing
				modifier = {
					factor = 0.2
					FROM = { has_character_flag = looted_by_raiding_holding }
				}
				modifier = {
					factor = 0.8
					num_of_artifacts = 3
				}
				modifier = {
					factor = 0.8
					num_of_artifacts = 4
				}
				modifier = {
					factor = 0.8
					num_of_artifacts = 5
				}
				modifier = {
					factor = 0.8
					num_of_artifacts = 6
				}
				modifier = {
					factor = 0.8
					num_of_artifacts = 7
				}
				modifier = {
					factor = 0.8
					num_of_artifacts = 8
				}
				modifier = {
					factor = 0.8
					num_of_artifacts = 9
				}
				modifier = {
					factor = 0.8
					num_of_artifacts = 10
				}
				modifier = {
					factor = 0.5
					NOT = {
						any_artifact = {
							quality == 1
						}
					}
				}
				modifier = {
					factor = 0.65
					NOT = {
						any_artifact = {
							quality == 2
						}
					}
				}
				modifier = {
					factor = 0.775
					NOT = {
						any_artifact = {
							quality == 3
						}
					}
				}
				modifier = {
					factor = 0.875
					NOT = {
						any_artifact = {
							quality == 4
						}
					}
				}
				modifier = {
					factor = 0.95
					NOT = {
						any_artifact = {
							quality == 5
						}
					}
				}
			}
		}
		FROM = {
			clr_character_flag = looted_by_raiding_holding
		}
	}
}

character_event = {
	id = MNM.9902
    desc = {
		text = EVTDESC_MNM_9902_A
		trigger = {
			looting_artifact_event_religious_artifacts_trigger = no
		}
	}
	desc = {
		text = EVTDESC_MNM_9902_B
		trigger = {
			looting_artifact_event_religious_artifacts_trigger = yes
		}
	}
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	immediate = {
		FROM = {
			random_artifact = {
				limit = {
					quality == 1
					NOT = {
						artifact_type_owned_by = ROOT
					}
				}
				set_artifact_flag = looted_artifact_tooltip_1
				set_artifact_flag = looted_artifact_tooltip_2
				transfer_artifact = {
					from = PREV
					to = ROOT
				}
			}
			character_event = { id = MNM.9903 }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_MNM_9902
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = no
			}
		}
		name = {
			text = EVTOPTB_MNM_9902
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = yes
			}
		}
		tooltip = {
			random_artifact = {
				limit = {
					has_artifact_flag = looted_artifact_tooltip_1
				}
				transfer_artifact = {
					from = FROM
					to = ROOT
				}
			}
		}
		hidden_effect = {
			random_artifact = {
				limit = {
					has_artifact_flag = looted_artifact_tooltip_1
				}
				clr_artifact_flag = looted_artifact_tooltip_1
			}
		}
	}
}

character_event = {
	id = MNM.9903
    desc = EVTDESC_MNM_9903
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_9903
		tooltip = {
			FROM = {
				random_artifact = {
					limit = {
						has_artifact_flag = looted_artifact_tooltip_2
					}
					transfer_artifact = {
						from = ROOT
						to = THIS
					}
				}
			}
		}
		hidden_effect = {
			FROM = {
				random_artifact = {
					limit = {
						has_artifact_flag = looted_artifact_tooltip_2
					}
					clr_artifact_flag = looted_artifact_tooltip_2
				}
			}
		}
	}
}

character_event = {
	id = MNM.9904
    desc = {
		text = EVTDESC_MNM_9902_A
		trigger = {
			looting_artifact_event_religious_artifacts_trigger = no
		}
	}
	desc = {
		text = EVTDESC_MNM_9902_B
		trigger = {
			looting_artifact_event_religious_artifacts_trigger = yes
		}
	}
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	immediate = {
		FROM = {
			random_artifact = {
				limit = {
					quality == 2
					NOT = {
						artifact_type_owned_by = ROOT
					}
				}
				set_artifact_flag = looted_artifact_tooltip_1
				set_artifact_flag = looted_artifact_tooltip_2
				transfer_artifact = {
					from = PREV
					to = ROOT
				}
			}
			character_event = { id = MNM.9905 }
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_MNM_9902
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = no
			}
		}
		name = {
			text = EVTOPTB_MNM_9902
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = yes
			}
		}
		tooltip = {
			random_artifact = {
				limit = {
					has_artifact_flag = looted_artifact_tooltip_1
				}
				transfer_artifact = {
					from = FROM
					to = ROOT
				}
			}
		}
		hidden_effect = {
			random_artifact = {
				limit = {
					has_artifact_flag = looted_artifact_tooltip_1
				}
				clr_artifact_flag = looted_artifact_tooltip_1
			}
		}
	}
}

character_event = {
	id = MNM.9905
    desc = EVTDESC_MNM_9903
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_9903
		tooltip = {
			FROM = {
				random_artifact = {
					limit = {
						has_artifact_flag = looted_artifact_tooltip_2
					}
					transfer_artifact = {
						from = ROOT
						to = THIS
					}
				}
			}
		}
		hidden_effect = {
			FROM = {
				random_artifact = {
					limit = {
						has_artifact_flag = looted_artifact_tooltip_2
					}
					clr_artifact_flag = looted_artifact_tooltip_2
				}
			}
		}
	}
}

character_event = {
	id = MNM.9906
    desc = {
		text = EVTDESC_MNM_9906_A
		trigger = {
			NOT = { has_character_flag = looted_artifact_destroy_duplicate }
			looting_artifact_event_religious_artifacts_trigger = no
		}
	}
	desc = {
		text = EVTDESC_MNM_9906_B
		trigger = {
			has_character_flag = looted_artifact_destroy_duplicate
			looting_artifact_event_religious_artifacts_trigger = no
		}
	}
	desc = {
		text = EVTDESC_MNM_9906_C
		trigger = {
			NOT = { has_character_flag = looted_artifact_destroy_duplicate }
			looting_artifact_event_religious_artifacts_trigger = yes
		}
	}
	desc = {
		text = EVTDESC_MNM_9906_D
		trigger = {
			has_character_flag = looted_artifact_destroy_duplicate
			looting_artifact_event_religious_artifacts_trigger = yes
		}
	}
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	immediate = {
		FROM = {
			random_artifact = {
				limit = {
					quality == 3
					NOT = {
						artifact_type_owned_by = ROOT
					}
				}
				set_artifact_flag = looted_artifact_tooltip_1
				set_artifact_flag = looted_artifact_tooltip_2
				transfer_artifact = {
					from = PREV
					to = ROOT
				}
			}
			if = {
				limit = {
					ROOT = {
						any_artifact = {
							has_artifact_flag = looted_artifact_tooltip_1
						}
					}
				}
				character_event = { id = MNM.9907 }
			}
			if = {
				limit = {
					NOT = {
						ROOT = {
							any_artifact = {
								has_artifact_flag = looted_artifact_tooltip_1
							}
						}
					}
				}
				random_artifact = {
					limit = {
						quality == 3
					}
					set_artifact_flag = looted_artifact_tooltip_1
					set_artifact_flag = looted_artifact_tooltip_2
				}
				ROOT = {
					set_character_flag = looted_artifact_destroy_duplicate
				}
			}
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_MNM_9906
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = no
			}
		}
		name = {
			text = EVTOPTC_MNM_9906
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = yes
			}
		}
		trigger = {
			NOT = { has_character_flag = looted_artifact_destroy_duplicate }
		}
		
		tooltip = {
			random_artifact = {
				limit = {
					has_artifact_flag = looted_artifact_tooltip_1
				}
				transfer_artifact = {
					from = FROM
					to = ROOT
				}
			}
		}
		hidden_effect = {
			random_artifact = {
				limit = {
					has_artifact_flag = looted_artifact_tooltip_1
				}
				clr_artifact_flag = looted_artifact_tooltip_1
			}
		}
	}
	
	option = {
		name = {
			text = EVTOPTB_MNM_9906
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = no
			}
		}
		name = {
			text = EVTOPTD_MNM_9906
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = yes
			}
		}
		trigger = {
			has_character_flag = looted_artifact_destroy_duplicate
		}
		tooltip = {
			FROM = {
				random_artifact = {
					limit = {
						has_artifact_flag = looted_artifact_tooltip_1
					}
					destroy_artifact = yes
				}
			}
		}
		hidden_effect = {
			random_artifact = {
				limit = {
					has_artifact_flag = looted_artifact_tooltip_1
				}
				clr_artifact_flag = looted_artifact_tooltip_1
			}
			FROM = {
				character_event = { id = MNM.9907 }
			}
		}
	}
}

character_event = {
	id = MNM.9907
    desc = {
		text = EVTDESC_MNM_9907_A
		trigger = {
			FROM = { NOT = { has_character_flag = looted_artifact_destroy_duplicate } }
		}
	}
	desc = {
		text = EVTDESC_MNM_9907_B
		trigger = {
			FROM = { has_character_flag = looted_artifact_destroy_duplicate }
		}
	}
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_9907
		trigger = {
			FROM  = { NOT = { has_character_flag = looted_artifact_destroy_duplicate } }
		}
		
		tooltip = {
			FROM = {
				random_artifact = {
					limit = {
						has_artifact_flag = looted_artifact_tooltip_2
					}
					transfer_artifact = {
						from = ROOT
						to = PREV
					}
				}
			}
		}
		hidden_effect = {
			FROM = {
				random_artifact = {
					limit = {
						has_artifact_flag = looted_artifact_tooltip_2
					}
					clr_artifact_flag = looted_artifact_tooltip_2
				}
			}
		}
	}
	
	option = {
		name = EVTOPTB_MNM_9907
		trigger = {
			FROM =  { has_character_flag = looted_artifact_destroy_duplicate }
		}
		
		random_artifact = {
			limit = {
				has_artifact_flag = looted_artifact_tooltip_2
			}
			clr_artifact_flag = looted_artifact_tooltip_2
			destroy_artifact = yes
		}
		FROM = {
			clr_character_flag = looted_artifact_destroy_duplicate
		}
	}
}

character_event = {
	id = MNM.9908
    desc = {
		text = EVTDESC_MNM_9906_A
		trigger = {
			NOT = { has_character_flag = looted_artifact_destroy_duplicate }
			looting_artifact_event_religious_artifacts_trigger = no
		}
	}
	desc = {
		text = EVTDESC_MNM_9906_B
		trigger = {
			has_character_flag = looted_artifact_destroy_duplicate
			looting_artifact_event_religious_artifacts_trigger = no
		}
	}
	desc = {
		text = EVTDESC_MNM_9906_C
		trigger = {
			NOT = { has_character_flag = looted_artifact_destroy_duplicate }
			looting_artifact_event_religious_artifacts_trigger = yes
		}
	}
	desc = {
		text = EVTDESC_MNM_9906_D
		trigger = {
			has_character_flag = looted_artifact_destroy_duplicate
			looting_artifact_event_religious_artifacts_trigger = yes
		}
	}
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	immediate = {
		FROM = {
			random_artifact = {
				limit = {
					quality == 4
					NOT = {
						artifact_type_owned_by = ROOT
					}
				}
				set_artifact_flag = looted_artifact_tooltip_1
				set_artifact_flag = looted_artifact_tooltip_2
				transfer_artifact = {
					from = PREV
					to = ROOT
				}
			}
			if = {
				limit = {
					ROOT = {
						any_artifact = {
							has_artifact_flag = looted_artifact_tooltip_1
						}
					}
				}
				character_event = { id = MNM.9909 }
			}
			if = {
				limit = {
					NOT = {
						ROOT = {
							any_artifact = {
								has_artifact_flag = looted_artifact_tooltip_1
							}
						}
					}
				}
				random_artifact = {
					limit = {
						quality == 4
					}
					set_artifact_flag = looted_artifact_tooltip_1
					set_artifact_flag = looted_artifact_tooltip_2
				}
				ROOT = {
					set_character_flag = looted_artifact_destroy_duplicate
				}
			}
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_MNM_9906
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = no
			}
		}
		name = {
			text = EVTOPTC_MNM_9906
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = yes
			}
		}
		trigger = {
			NOT = { has_character_flag = looted_artifact_destroy_duplicate }
		}
		
		tooltip = {
			random_artifact = {
				limit = {
					has_artifact_flag = looted_artifact_tooltip_1
				}
				transfer_artifact = {
					from = FROM
					to = ROOT
				}
			}
		}
		hidden_effect = {
			random_artifact = {
				limit = {
					has_artifact_flag = looted_artifact_tooltip_1
				}
				clr_artifact_flag = looted_artifact_tooltip_1
			}
		}
	}
	
	option = {
		name = {
			text = EVTOPTB_MNM_9906
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = no
			}
		}
		name = {
			text = EVTOPTD_MNM_9906
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = yes
			}
		}
		trigger = {
			has_character_flag = looted_artifact_destroy_duplicate
		}
		tooltip = {
			FROM = {
				random_artifact = {
					limit = {
						has_artifact_flag = looted_artifact_tooltip_1
					}
					destroy_artifact = yes
				}
			}
		}
		hidden_effect = {
			random_artifact = {
				limit = {
					has_artifact_flag = looted_artifact_tooltip_1
				}
				clr_artifact_flag = looted_artifact_tooltip_1
			}
			FROM = {
				character_event = { id = MNM.9909 }
			}
		}
	}
}

character_event = {
	id = MNM.9909
    desc = {
		text = EVTDESC_MNM_9907_A
		trigger = {
			FROM = { NOT = { has_character_flag = looted_artifact_destroy_duplicate } }
		}
	}
	desc = {
		text = EVTDESC_MNM_9907_B
		trigger = {
			FROM = { has_character_flag = looted_artifact_destroy_duplicate }
		}
	}
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_9907
		trigger = {
			FROM  = { NOT = { has_character_flag = looted_artifact_destroy_duplicate } }
		}
		
		tooltip = {
			FROM = {
				random_artifact = {
					limit = {
						has_artifact_flag = looted_artifact_tooltip_2
					}
					transfer_artifact = {
						from = ROOT
						to = THIS
					}
				}
			}
		}
		hidden_effect = {
			FROM = {
				random_artifact = {
					limit = {
						has_artifact_flag = looted_artifact_tooltip_2
					}
					clr_artifact_flag = looted_artifact_tooltip_2
				}
			}
		}
	}
	
	option = {
		name = EVTOPTB_MNM_9907
		trigger = {
			FROM =  { has_character_flag = looted_artifact_destroy_duplicate }
		}
		
		random_artifact = {
			limit = {
				has_artifact_flag = looted_artifact_tooltip_2
			}
			clr_artifact_flag = looted_artifact_tooltip_2
			destroy_artifact = yes
		}
		FROM = {
			clr_character_flag = looted_artifact_destroy_duplicate
		}
	}
}

character_event = {
	id = MNM.9910
    desc = {
		text = EVTDESC_MNM_9910_A
		trigger = {
			NOT = { has_character_flag = looted_artifact_destroy_duplicate }
			looting_artifact_event_religious_artifacts_trigger = no
		}
	}
	desc = {
		text = EVTDESC_MNM_9910_B
		trigger = {
			has_character_flag = looted_artifact_destroy_duplicate
			looting_artifact_event_religious_artifacts_trigger = no
		}
	}
	desc = {
		text = EVTDESC_MNM_9910_C
		trigger = {
			NOT = { has_character_flag = looted_artifact_destroy_duplicate }
			looting_artifact_event_religious_artifacts_trigger = yes
		}
	}
	desc = {
		text = EVTDESC_MNM_9910_D
		trigger = {
			has_character_flag = looted_artifact_destroy_duplicate
			looting_artifact_event_religious_artifacts_trigger = yes
		}
	}
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	immediate = {
		FROM = {
			random_artifact = {
				limit = {
					quality == 5
					NOT = {
						artifact_type_owned_by = ROOT
					}
				}
				set_artifact_flag = looted_artifact_tooltip_1
				set_artifact_flag = looted_artifact_tooltip_2
				transfer_artifact = {
					from = PREV
					to = ROOT
				}
			}
			if = {
				limit = {
					ROOT = {
						any_artifact = {
							has_artifact_flag = looted_artifact_tooltip_1
						}
					}
				}
				character_event = { id = MNM.9911 }
			}
			if = {
				limit = {
					NOT = {
						ROOT = {
							any_artifact = {
								has_artifact_flag = looted_artifact_tooltip_1
							}
						}
					}
				}
				random_artifact = {
					limit = {
						quality == 5
					}
					set_artifact_flag = looted_artifact_tooltip_1
					set_artifact_flag = looted_artifact_tooltip_2
				}
				ROOT = {
					set_character_flag = looted_artifact_destroy_duplicate
				}
			}
		}
	}
	
	option = {
		name = {
			text = EVTOPTA_MNM_9910
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = no
			}
		}
		name = {
			text = EVTOPTC_MNM_9910
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = yes
			}
		}
		trigger = {
			NOT = { has_character_flag = looted_artifact_destroy_duplicate }
		}
		
		tooltip = {
			random_artifact = {
				limit = {
					has_artifact_flag = looted_artifact_tooltip_1
				}
				transfer_artifact = {
					from = FROM
					to = ROOT
				}
			}
		}
		hidden_effect = {
			random_artifact = {
				limit = {
					has_artifact_flag = looted_artifact_tooltip_1
				}
				clr_artifact_flag = looted_artifact_tooltip_1
			}
		}
	}
	
	option = {
		name = {
			text = EVTOPTB_MNM_9910
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = no
			}
		}
		name = {
			text = EVTOPTD_MNM_9910
			trigger = {
				looting_artifact_event_religious_artifacts_trigger = yes
			}
		}
		trigger = {
			has_character_flag = looted_artifact_destroy_duplicate
		}
		tooltip = {
			FROM = {
				random_artifact = {
					limit = {
						has_artifact_flag = looted_artifact_tooltip_1
					}
					destroy_artifact = yes
				}
			}
		}
		hidden_effect = {
			random_artifact = {
				limit = {
					has_artifact_flag = looted_artifact_tooltip_1
				}
				clr_artifact_flag = looted_artifact_tooltip_1
			}
			FROM = {
				character_event = { id = MNM.9911 }
			}
		}
	}
}

character_event = {
	id = MNM.9911
    desc = {
		text = EVTDESC_MNM_9911_A
		trigger = {
			FROM = { NOT = { has_character_flag = looted_artifact_destroy_duplicate } }
		}
	}
	desc = {
		text = EVTDESC_MNM_9911_B
		trigger = {
			FROM = { has_character_flag = looted_artifact_destroy_duplicate }
		}
	}
    picture = GFX_evt_relic_box
    border = GFX_event_normal_frame_war
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_MNM_9911
		trigger = {
			FROM  = { NOT = { has_character_flag = looted_artifact_destroy_duplicate } }
		}
		
		tooltip = {
			FROM = {
				random_artifact = {
					limit = {
						has_artifact_flag = looted_artifact_tooltip_2
					}
					transfer_artifact = {
						from = ROOT
						to = THIS
					}
				}
			}
		}
		hidden_effect = {
			FROM = {
				random_artifact = {
					limit = {
						has_artifact_flag = looted_artifact_tooltip_2
					}
					clr_artifact_flag = looted_artifact_tooltip_2
				}
			}
		}
	}
	
	option = {
		name = EVTOPTB_MNM_9911
		trigger = {
			FROM =  { has_character_flag = looted_artifact_destroy_duplicate }
		}
		
		random_artifact = {
			limit = {
				has_artifact_flag = looted_artifact_tooltip_2
			}
			clr_artifact_flag = looted_artifact_tooltip_2
			destroy_artifact = yes
		}
		FROM = {
			clr_character_flag = looted_artifact_destroy_duplicate
		}
	}
}