namespace = artifact
# TODO - events for Raven's Armor, Seeing Stone and Nehalenia's Mirror
# TODO - events for Sephirots

################################################
# Gwyhyr swords
################################################
# Ping - Courtier offers to sell his sword
character_event = {
	id = artifact.1000
	desc = PING
	picture = GFX_evt_emissary
	
	capable_only = yes
	ai = yes
	
	trigger = {
		has_artifact = gwyhyr_sword
		NOT = { trait = master_warrior }
		NOT = { trait = skilled_warrior }
		NOT = { trait = trained_warrior }
		liege = {
			wealth = 100
			NOT = { has_artifact = gwyhyr_sword }
		}
	}
	
	mean_time_to_happen = {
		months = 60
		modifier = { factor = 0.5 liege = { wealth = 200 } }
		modifier = { factor = 0.5 liege = { wealth = 300 } }
		modifier = { factor = 0.5 liege = { wealth = 400 } }
		modifier = {
			factor = 4
			liege = {
				OR = {
					has_artifact = sihil
					has_artifact = gveir
					has_artifact = zireael
					has_artifact = balmur
					has_artifact = loathen
					has_artifact = zefhar_bow
				}
			}
		}
	}
	
	option = {
		name = "OK"
		liege = { character_event = { id = artifact.1001 } }
	}
}
# Liege - Courtier offers to sell his sword
character_event = {
	id = artifact.1001
	desc = EVTDESCartifact.1001
	picture = GFX_evt_emissary
	
	is_triggered_only = yes
	
	only_rulers = yes
	min_age = 15
	capable_only = yes
	
	option = { # Buy
		name = EVTOPTAartifact.1001
		wealth = -100
		FROM = {
			wealth = 100
			random_artifact = {
				limit = {
					artifact_type = gwyhyr_sword
				}
				transfer_artifact = {
					from = FROM
					to = ROOT
				}
			}
		}
		ai_chance = {
			factor = 1
			modifier = { factor = 2 trait = proud }
			modifier = { factor = 1.5 trait = master_warrior }
			modifier = { factor = 1.5 trait = skilled_warrior }
			modifier = { factor = 2 wealth = 200 }
		}
	}
	option = { # Don't buy
		name = EVTOPTBartifact.1001
		ai_chance = {
			factor = 1
			modifier = { factor = 2 trait = greedy }
			modifier = { factor = 2 trait = content }
			modifier = { factor = 2 war = yes }
		}
	}
}
# Merchant offers to sell sword
character_event = {
	id = artifact.1002
	desc = EVTDESCartifact.1002
	picture = GFX_evt_market
	
	only_rulers = yes
	min_age = 15
	capable_only = yes
	
	is_triggered_only = yes # Disabled - artifacts generated via artifact_spawns
	
	trigger = {
		NOT = { has_artifact = gwyhyr_sword }
		wealth = 150
	}
	
	mean_time_to_happen = {
		months = 5000
		modifier = { factor = 0.5 wealth = 300 }
		modifier = { factor = 0.5 wealth = 600 }
		modifier = { factor = 0.5 wealth = 900 }
		modifier = { factor = 0.5 trait = ambitious }
		modifier = { factor = 0.9 trait = charitable }
		modifier = { factor = 0.9 trait = trusting }
		modifier = { factor = 1.1 trait = paranoid }
		modifier = { factor = 1.1 trait = greedy }
		modifier = {
			factor = 4
			OR = {
				has_artifact = sihil
				has_artifact = gveir
				has_artifact = zireael
				has_artifact = balmur
				has_artifact = loathen
				has_artifact = zefhar_bow
			}
		}
	}
	
	option = { # Buy
		name = EVTOPTAartifact.1002
		wealth = -150
		add_artifact = gwyhyr_sword
		hidden_tooltip = {
			random = {
				chance = 20
				character_event = { id = artifact.1003 days = 70 random = 20 }
			}
		}
		ai_chance = {
			factor = 1
			modifier = { factor = 2 trait = charitable }
			modifier = { factor = 2 trait = trusting }
			modifier = { factor = 1.5 trait = master_warrior }
			modifier = { factor = 1.5 trait = skilled_warrior }
			modifier = { factor = 2 wealth = 300 }
		}
	}
	option = { # Don't buy
		name = EVTOPTBartifact.1002
		ai_chance = {
			factor = 1
			modifier = { factor = 2 trait = paranoid }
			modifier = { factor = 2 trait = greedy }
			modifier = { factor = 2 trait = content }
			modifier = { factor = 2 war = yes }
			modifier = { factor = 2 ai = yes }
		}
	}
}
# Sword sold by merchant turned out to be a fake
character_event = {
	id = artifact.1003
	desc = EVTDESCartifact.1003
	picture = GFX_evt_bad_news
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1003
		destroy_artifact = gwyhyr_sword
		if = {
			limit = { NOT = { trait = trusting} }
			random = {
				chance = 20
				add_trait = trusting
				hidden_tooltip = { character_event = { id = 38250 } }
			}
		}
	}
}
# Found sword in your castle
character_event = {
	id = artifact.1004
	desc = EVTDESCartifact.1004
	picture = GFX_evt_castle_construction
	
	only_rulers = yes
	min_age = 15
	capable_only = yes
	
	is_triggered_only = yes # Disabled - artifacts generated via artifact_spawns
	
	trigger = {
		NOT = { has_artifact = gwyhyr_sword }
	}
	
	mean_time_to_happen = {
		months = 12000
		modifier = { factor = 0.5 trait = ambitious }
		modifier = { factor = 0.7 trait = diligent }
		modifier = { factor = 0.9 trait = shy }
		modifier = { factor = 0.9 trait = patient }
		modifier = { factor = 1.3 trait = slothful }
		modifier = { factor = 1.1 trait = gregarious }
		modifier = { factor = 1.1 trait = wroth }
		modifier = {
			factor = 4
			OR = {
				has_artifact = sihil
				has_artifact = gveir
				has_artifact = zireael
				has_artifact = balmur
				has_artifact = loathen
				has_artifact = zefhar_bow
			}
		}
	}
	
	option = {
		name = EVTOPTAartifact.1004
		add_artifact = gwyhyr_sword
	}
}
# Traveling knight with sword
character_event = {
	id = artifact.1005
	desc = EVTDESCartifact.1005
	picture = GFX_evt_knight_kneeling
	
	only_rulers = yes
	min_age = 15
	capable_only = yes
	
	is_triggered_only = yes # Disabled - artifacts generated via artifact_spawns
	
	trigger = {
		NOT = { has_artifact = gwyhyr_sword }
	}
	
	mean_time_to_happen = {
		months = 10000
		modifier = { factor = 0.5 trait = ambitious }
		modifier = {
			factor = 4
			OR = {
				has_artifact = sihil
				has_artifact = gveir
				has_artifact = zireael
				has_artifact = balmur
				has_artifact = loathen
				has_artifact = zefhar_bow
			}
		}
	}
	
	option = { #  Offer to buy
		name = EVTOPTAartifact.1005
		custom_tooltip = {
			text = offer_to_buy_the_sword
			hidden_tooltip = {
				random_list = {
					50 = { character_event = { id = artifact.1006 days = 1 } }
					50 = { character_event = { id = artifact.1007 days = 1 } }
				}
			}
		}
		ai_chance = {
			factor = 1
			modifier = { factor = 2 trait = charitable }
			modifier = { factor = 2 trait = honest }
			modifier = { factor = 2 trait = kind }
			modifier = { factor = 1.5 trait = master_warrior }
			modifier = { factor = 1.5 trait = skilled_warrior }
			modifier = { factor = 2 wealth = 300 }
		}
	}
	option = { # Take with force
		name = EVTOPTBartifact.1005
		custom_tooltip = { text = take_sword_by_force }
		add_artifact = gwyhyr_sword
		if = {
			limit = { NOT = { trait = greedy } }
			random = {
				chance = 50
				add_trait = greedy
				hidden_tooltip = { character_event = { id = 38252 } }
			}
		}
		ai_chance = {
			factor = 1
			modifier = { factor = 2 trait = greedy }
			modifier = { factor = 2 trait = deceitful }
			modifier = { factor = 2 trait = wroth }
			modifier = { factor = 1.5 trait = master_warrior }
			modifier = { factor = 1.5 trait = skilled_warrior }
			modifier = { factor = 2 war = yes }
		}
	}
	option = { # Do nothing
		name = EVTOPTCartifact.1005
		ai_chance = {
			factor = 1
			modifier = { factor = 2 trait = greedy }
			modifier = { factor = 2 trait = honest }
			modifier = { factor = 2 trait = kind }
			modifier = { factor = 2 war = yes }
			modifier = { factor = 2 ai = yes }
		}
	}
}
# Traveling knight with sword agreed to sell sword
character_event = {
	id = artifact.1006
	desc = EVTDESCartifact.1006
	picture = GFX_evt_knight_kneeling
	
	is_triggered_only = yes
	
	option = { # Perfect
		name = EVTOPTAartifact.1006
		wealth = -200
		add_artifact = gwyhyr_sword
	}
	option = { # No he asks too much
		name = EVTOPTBartifact.1006
		ai_chance = { factor = 0 }
	}
}
# Traveling knight with sword declined to sell sword
character_event = {
	id = artifact.1007
	desc = EVTDESCartifact.1007
	picture = GFX_evt_knight_kneeling
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1007
	}
}

################################################
# Living Purple Bone and Conynhaela
################################################

# Event when triggering decision to use the herbs
character_event = {
	id = artifact.1011
	desc = EVTDESCartifact.1011
	picture = GFX_evt_recovery
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1011
		if = {
			limit = { trait = wounded }
			remove_trait = wounded
		}
		if = {
			limit = { trait = maimed }
			remove_trait = maimed
		}
		if = {
			limit = { trait = infirm }
			remove_trait = infirm
		}
		destroy_artifact = purple_living_bone
		destroy_artifact = conynhaela
	}
}
# Finding one of the herbs
character_event = {
	id = artifact.1012
	desc = EVTDESCartifact.1012
	picture = GFX_evt_bandits
	
	only_rulers = yes
	
	trigger = {
		NOT = { has_artifact = purple_living_bone }
		NOT = { has_artifact = conynhaela }
		any_demesne_province = { terrain = dryad_forest }
	}
	
	mean_time_to_happen = {
		months = 3500
		modifier = { factor = 0.5 trait = gardener }
		modifier = { factor = 0.7 trait = diligent }
		modifier = { factor = 0.9 trait = patient }
		modifier = { factor = 1.3 trait = slothful }
		modifier = { factor = 1.1 trait = wroth }
	}
	
	option = {
		name = EVTOPTAartifact.1012
		random_list = {
			20 = {
				if = { 
					limit = { NOT = { has_artifact = purple_living_bone } }
					add_artifact = purple_living_bone
					hidden_tooltip = { character_event = { id = artifact.1013 } }
				}
			}
			20 = {
				if = { 
					limit = { NOT = { has_artifact = conynhaela } }
					add_artifact = conynhaela
					hidden_tooltip = { character_event = { id = artifact.1014 } }
				}
			}
			60 = { }
		}
	}
	option = {
		name = EVTOPTBartifact.1012
		prestige = 20
	}
}
# Getting Conynhaela
character_event = {
	id = artifact.1013
	desc = EVTDESCartifact.1013
	picture = GFX_evt_bandits
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1013
	}
}
# Getting Purple living bone
character_event = {
	id = artifact.1014
	desc = EVTDESCartifact.1014
	picture = GFX_evt_bandits
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1014
	}
}

################################################
# Brisingamen
################################################
# Brisingamen appears
character_event = {
	id = artifact.1020
	desc = EVTDESCartifact.1020
	picture = GFX_evt_comet
	
	trigger = {
		NOT = { has_global_flag = brisingamen_exists }
		religion = freya
		OR = {
			piety = 1000
			AND = {
				trait = zealous
				piety = 500
			}
		}
	}
	
	mean_time_to_happen = {
		months = 120
		modifier = { factor = 0.5 trait = zealous }
		modifier = { factor = 0.8 piety = 750 }
		modifier = { factor = 0.8 piety = 875 }
		modifier = { factor = 0.8 piety = 1000 }
		modifier = { factor = 0.8 piety = 1125 }
		modifier = { factor = 0.8 piety = 1250 }
	}
	
	option = {
		name = EVTOPTAartifact.1020
		add_artifact = brisingamen
		set_global_flag = brisingamen_exists
	}
}
# Brisingamen disappears when heir inherits it
character_event = {
	id = artifact.1021
	desc = EVTDESCartifact.1021
	picture = GFX_evt_comet
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1021
	}
}
# Brisingamen disappears because of religion change
character_event = {
	id = artifact.1022
	desc = EVTDESCartifact.1022
	picture = GFX_evt_comet
	
	trigger = {
		has_artifact = brisingamen
		NOT = { religion = freya }
	}
	
	mean_time_to_happen = {
		days = 365
	}
	
	option = {
		name = EVTOPTAartifact.1022
		destroy_artifact = brisingamen
		clr_global_flag = brisingamen_exists
	}
}

################################################
# Zefhar Bow
################################################
# Merchant offers to sell zefhar bow
character_event = {
	id = artifact.1030
	desc = EVTDESCartifact.1030
	picture = GFX_evt_market
	
	only_rulers = yes
	min_age = 15
	capable_only = yes
	
	is_triggered_only = yes # Disabled - artifacts generated via artifact_spawns
	
	trigger = {
		NOT = { has_artifact = zefhar_bow }
		wealth = 150
	}
	
	mean_time_to_happen = {
		months = 5000
		modifier = { factor = 0.5 wealth = 300 }
		modifier = { factor = 0.5 wealth = 600 }
		modifier = { factor = 0.5 wealth = 900 }
		modifier = { factor = 0.5 trait = ambitious }
		modifier = { factor = 0.9 trait = charitable }
		modifier = { factor = 0.9 trait = trusting }
		modifier = { factor = 1.1 trait = paranoid }
		modifier = { factor = 1.1 trait = greedy }
		modifier = {
			factor = 4
			OR = {
				has_artifact = gwyhyr_sword
				has_artifact = sihil
				has_artifact = gveir
				has_artifact = zireael
				has_artifact = balmur
				has_artifact = loathen
			}
		}
	}
	
	option = { # Buy
		name = EVTOPTAartifact.1030
		wealth = -150
		add_artifact = zefhar_bow
		ai_chance = {
			factor = 1
			modifier = { factor = 2 trait = charitable }
			modifier = { factor = 2 trait = trusting }
			modifier = { factor = 1.5 trait = master_warrior }
			modifier = { factor = 1.5 trait = skilled_warrior }
			modifier = { factor = 2 wealth = 300 }
		}
	}
	option = { # Don't buy
		name = EVTOPTBartifact.1030
		hidden_tooltip = {
			random = {
				chance = 20
				character_event = { id = artifact.1031 days = 70 random = 20 }
			}
		}
		ai_chance = {
			factor = 1
			modifier = { factor = 2 trait = paranoid }
			modifier = { factor = 2 trait = greedy }
			modifier = { factor = 2 trait = content }
			modifier = { factor = 2 war = yes }
			modifier = { factor = 2 ai = yes }
		}
	}
}
# Bow sold by merchant turned out to be a fake
character_event = {
	id = artifact.1031
	desc = EVTDESCartifact.1031
	picture = GFX_evt_bad_news
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1031
		destroy_artifact = zefhar_bow
		if = {
			limit = { NOT = { trait = trusting} }
			random = {
				chance = 20
				add_trait = trusting
				hidden_tooltip = { character_event = { id = 38250 } }
			}
		}
	}
}
# A dead poacher in your forest with zephar bow had fallen prey to monsters
character_event = {
	id = artifact.1032
	desc = EVTDESCartifact.1032
	picture = GFX_evt_bandits
	
	only_rulers = yes
	min_age = 15
	capable_only = yes
	
	is_triggered_only = yes # Disabled - artifacts generated via artifact_spawns
	
	trigger = {
		NOT = { has_artifact = zefhar_bow }
		wealth = 150
	}
	
	mean_time_to_happen = {
		months = 12000
		modifier = { factor = 0.75 trait = hunter }
		modifier = { factor = 0.75 trait = falconer }
		modifier = { factor = 0.9 trait = diligent }
		modifier = { factor = 0.9 trait = gregarious }
		modifier = { factor = 1.1 trait = slothful }
		modifier = { factor = 1.1 trait = greedy }
		modifier = {
			factor = 4
			OR = {
				has_artifact = gwyhyr_sword
				has_artifact = sihil
				has_artifact = gveir
				has_artifact = zireael
				has_artifact = balmur
				has_artifact = loathen
			}
		}
	}
	
	option = { # Take the bow
		name = EVTOPTAartifact.1032
		add_artifact = zefhar_bow
		piety = -30
		ai_chance = {
			factor = 1
			modifier = { factor = 2 trait = cynical }
			modifier = { factor = 2 trait = greedy }
			modifier = { factor = 2 trait = envious }
			modifier = { factor = 1.5 trait = master_warrior }
			modifier = { factor = 1.5 trait = skilled_warrior }
		}
	}
	option = { # Bury the corpse with bow
		name = EVTOPTBartifact.1032
		piety = 30
		ai_chance = {
			factor = 1
			modifier = { factor = 2 trait = kind }
			modifier = { factor = 2 trait = zealous }
			modifier = { factor = 2 trait = elf_race }
			modifier = { factor = 2 trait = halfelf_race }
		}
	}
}
# An elven traveler gifts you bow
character_event = {
	id = artifact.1033
	desc = EVTDESCartifact.1033
	picture = GFX_evt_throne_room
	
	only_rulers = yes
	min_age = 15
	capable_only = yes
	
	is_triggered_only = yes # Disabled - artifacts generated via artifact_spawns
	
	trigger = {
		NOT = { has_artifact = zefhar_bow }
		OR = { 
			trait = elf_race
			trait = halfelf_race
			trait = tolerant
		}
	}
	
	mean_time_to_happen = {
		months = 9000
		modifier = { factor = 0.8 prestige = 200 }
		modifier = { factor = 0.8 prestige = 400 }
		modifier = { factor = 0.8 prestige = 600 }
		modifier = { factor = 0.75 trait = hunter }
		modifier = { factor = 0.9 trait = charitable }
		modifier = { factor = 0.9 trait = kind }
		modifier = { factor = 0.9 trait = humble }
		modifier = { factor = 1.1 trait = greedy }
		modifier = { factor = 1.1 trait = envious }
		modifier = { factor = 1.1 trait = proud }
		modifier = {
			factor = 4
			OR = {
				has_artifact = gwyhyr_sword
				has_artifact = sihil
				has_artifact = gveir
				has_artifact = zireael
				has_artifact = balmur
				has_artifact = loathen
			}
		}
	}
	
	option = { # Take it
		name = EVTOPTAartifact.1033
		add_artifact = zefhar_bow
		ai_chance = {
			factor = 1
			modifier = { factor = 2 trait = hunter }
			modifier = { factor = 2 trait = wroth }
			modifier = { factor = 2 trait = proud }
			modifier = { factor = 2 trait = greedy }
		}
	}
	option = { # No I cannot accept such gift
		name = EVTOPTBartifact.1033
		prestige = 20
		if = {
			limit = { NOT = { trait = kind} }
			random = {
				chance = 30
				add_trait = kind
				hidden_tooltip = { character_event = { id = 38268 } }
			}
		}
		ai_chance = {
			factor = 0
		}
	}
	option = { # How about ending your travels and staying here
		name = EVTOPTCartifact.1033
		create_random_soldier = {
			random_traits = yes
			dynasty = NONE
			female = no
			culture = aen_seidhe
			religion = dana_meadbh
			age = 250
			trait = elf_race
			trait = hunter
		}
		new_character = {
			change_martial = 2
			remove_trait = inbred
			remove_trait = imbecile
			random_list = {
				50 = { add_trait = trained_warrior }
				50 = { add_trait = skilled_warrior }
			}
			add_artifact = zefhar_bow
		}
		ai_chance = {
			factor = 1
			modifier = { factor = 2 trait = kind }
			modifier = { factor = 2 trait = humble }
			modifier = { factor = 2 trait = charitable }
		}
	}
}

################################################
# Gveir
################################################
# Rumors about Gveir somewhere in Korath desert
character_event = {
	id = artifact.1040
	desc = EVTDESCartifact.1040
	picture = GFX_evt_spymaster
	
	only_rulers = yes
	min_age = 15
	capable_only = yes
	
	trigger = {
		NOT = { has_global_flag = gveir_exists }
		any_demesne_province = {
			OR = {
				province_id = 368 # Mijara
				province_id = 365 # Ciosuecia
				province_id = 232 # Medemblik
				province_id = 213 # Tecen
				province_id = 206 # Rozvlaha
				province_id = 208 # Rozbohateti
				province_id = 207 # Zlodjejcje
			}
		}
		wealth = 50
		NOT = { has_global_flag = expedition_for_gveir_underway }
	}
	
	mean_time_to_happen = {
		months = 10000
		modifier = { factor = 0.5 wealth = 100 }
		modifier = {
			factor = 4
			OR = {
				has_artifact = gwyhyr_sword
				has_artifact = sihil
				has_artifact = zireael
				has_artifact = balmur
				has_artifact = loathen
				has_artifact = zefhar_bow
			}
		}
	}
	
	option = { # Send expedition to recover it
		name = EVTOPTAartifact.1040
		wealth = -50
		custom_tooltip = {
			text = send_expedition_to_recover_gveir
			hidden_tooltip = {
				random_list = {
					50 = { character_event = { id = artifact.1041 days = 100 random = 20 } }
					50 = { character_event = { id = artifact.1042 days = 300 random = 60 } }
				}
			}
		}
		set_global_flag = expedition_for_gveir_underway
	}
	option = { # They are just baseless rumors
		name = EVTOPTBartifact.1040
		ai_chance = {
			factor = 0
		}
		
	}
}
# Expedition returned with Gveir
character_event = {
	id = artifact.1041
	desc = EVTDESCartifact.1041
	picture = GFX_evt_throne_room
	
	is_triggered_only = yes
	
	immediate = {
		clr_global_flag = expedition_for_gveir_underway
	}
	
	option = { # It beautiful sword
		name = EVTOPTAartifact.1041
		add_artifact = gveir
		set_global_flag = gveir_exists
	}
	option = { # It's even better than tought, there will be extra rewards
		name = EVTOPTBartifact.1041
		add_artifact = gveir
		set_global_flag = gveir_exists
		wealth = -20
		if = {
			limit = { NOT = { trait = charitable } }
			random = {
				chance = 25
				add_trait = charitable
				hidden_tooltip = { character_event = { id = 38273 } }
			}
		}
	}
}
# Expedition never returned
character_event = {
	id = artifact.1042
	desc = EVTDESCartifact.1042
	picture = GFX_evt_throne_room
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1042
		clr_global_flag = expedition_for_gveir_underway
	}
}

################################################
# Balmur
################################################
# Rumors about sword in stone
character_event = {
	id = artifact.1050
	desc = EVTDESCartifact.1050
	picture = GFX_evt_spymaster
	
	only_rulers = yes
	min_age = 15
	capable_only = yes
	
	trigger = {
		NOT = { has_global_flag = balmur_exists }
		NOR = {
			has_global_flag = balmur_sword_in_stone
			has_global_flag = balmur_sword_from_lake
		}
		prestige = 100
	}
	
	mean_time_to_happen = {
		months = 40000
		modifier = { factor = 2 has_artifact = gwyhyr_sword }
		modifier = { factor = 0.8 prestige = 200 }
		modifier = { factor = 0.8 prestige = 400 }
		modifier = { factor = 0.8 prestige = 600 }
		modifier = { factor = 0.8 prestige = 800 }
		modifier = { factor = 0.5 tier = emperor }
		modifier = { factor = 0.6 tier = king }
		modifier = { factor = 0.75 tier = duke }
		modifier = {
			factor = 4
			OR = {
				has_artifact = gwyhyr_sword
				has_artifact = sihil
				has_artifact = gveir
				has_artifact = zireael
				has_artifact = loathen
				has_artifact = zefhar_bow
			}
		}
	}
	
	option = {
		name = EVTOPTAartifact.1050
		set_global_flag = balmur_sword_in_stone
		character_event = { id = artifact.1051 days = 300 random = 100 }
	}
}
# Sword in stone suddenly appears in your courtyard
character_event = {
	id = artifact.1051
	desc = EVTDESCartifact.1051
	picture = GFX_evt_scandal
	
	is_triggered_only = yes
	
	immediate = {
		clr_global_flag = balmur_sword_in_stone
	}
	
	option = { # Try to pull it out
		name = EVTOPTAartifact.1051
		trigger = { is_strong_trigger = yes }
		tooltip_info = strong
		custom_tooltip = {
			text = attempt_to_pull_balmur_out_of_stone
			hidden_tooltip = {
				if = {
					limit = { prestige = 500 }
					add_artifact = balmur
					set_global_flag = balmur_exists
				}
				if = {
					limit = { NOT = { prestige = 500 } }
					random_list = {
						50 = {
							add_artifact = balmur
							set_global_flag = balmur_exists
							character_event = { id = artifact.1052 days = 3 }
						}
						50 = {
							character_event = { id = artifact.1053 days = 3 }
						}
					}
				}
			}
		}
	}
	option = { # Try to pull it out
		name = EVTOPTAartifact.1051
		trigger = { NOT = { is_strong_trigger = yes } }
		custom_tooltip = {
			text = attempt_to_pull_balmur_out_of_stone
			hidden_tooltip = {
				if = {
					limit = { prestige = 500 }
					add_artifact = balmur
					set_global_flag = balmur_exists
				}
				if = {
					limit = { NOT = { prestige = 500 } }
					random_list = {
						80 = {
							add_artifact = balmur
							set_global_flag = balmur_exists
							character_event = { id = artifact.1052 }
						}
						20 = {
							character_event = { id = artifact.1053 }
						}
					}
				}
			}
		}
	}
	option = { # I'm not worthy
		name = EVTOPTBartifact.1051
		prestige = 20
		hidden_tooltip = { character_event = { id = artifact.1054 days = 1 } }
		ai_chance = {
			factor = 0
		}
	}
}
# Pulled Balmur from stone
character_event = {
	id = artifact.1052
	desc = EVTDESCartifact.1052
	picture = GFX_evt_scandal
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1052
		add_artifact = balmur
		set_global_flag = balmur_exists
	}
}
# Didn't pull Balmur from stone
character_event = {
	id = artifact.1053
	desc = EVTDESCartifact.1053
	picture = GFX_evt_scandal
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1053
	}
}
# Stone with sword disappear
character_event = {
	id = artifact.1054
	desc = EVTDESCartifact.1054
	picture = GFX_evt_scandal
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1054
	}
}
# Rumors about sword from lake
character_event = {
	id = artifact.1055
	desc = EVTDESCartifact.1055
	picture = GFX_evt_spymaster
	
	only_rulers = yes
	min_age = 15
	capable_only = yes
	
	trigger = {
		NOT = { has_global_flag = balmur_exists }
		NOR = {
			has_global_flag = balmur_sword_in_stone
			has_global_flag = balmur_sword_from_lake
		}
		prestige = 500
	}
	
	mean_time_to_happen = {
		months = 20000
		modifier = { factor = 2 has_artifact = gwyhyr_sword }
		modifier = { factor = 0.8 prestige = 750 }
		modifier = { factor = 0.8 prestige = 875 }
		modifier = { factor = 0.8 prestige = 1000 }
		modifier = { factor = 0.5 tier = emperor }
		modifier = { factor = 0.6 tier = king }
		modifier = { factor = 0.75 tier = duke }
		modifier = {
			factor = 4
			OR = {
				has_artifact = gwyhyr_sword
				has_artifact = sihil
				has_artifact = gveir
				has_artifact = zireael
				has_artifact = loathen
				has_artifact = zefhar_bow
			}
		}
	}
	
	option = {
		name = EVTOPTAartifact.1055
		set_global_flag = balmur_sword_from_lake
		character_event = { id = artifact.1056 days = 300 random = 100 }
	}
}
# Hand appeared from lake and gave you sword
character_event = {
	id = artifact.1056
	desc = EVTDESCartifact.1056
	picture = GFX_evt_scandal
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1056
		clr_global_flag = balmur_sword_from_lake
		add_artifact = balmur
		set_global_flag = balmur_exists
	}
}

################################################
# Raven's armor
################################################
# Found Raven's armor
character_event = {
	id = artifact.1060
	desc = EVTDESCartifact.1060
	picture = GFX_evt_pagan
	
	only_rulers = yes
	min_age = 15
	capable_only = yes
	
	trigger = {
		NOT = { has_global_flag = ravens_armor_exists }
		wealth = 50
		NOT = { has_global_flag = repairing_ravens_armor }
		location = { region = world_the_north }
	}
	
	mean_time_to_happen = {
		months = 20000
		modifier = { factor = 0.5 wealth = 100 }
	}
	
	option = { # Find blacksmith to repair it
		name = EVTOPTAartifact.1060
		set_global_flag = repairing_ravens_armor
		custom_tooltip = {
			text = repair_ravens_armor
			hidden_tooltip = {
				random_list = {
					60 = { character_event = { id = artifact.1061 days = 50 random = 20 } }
					40 = { character_event = { id = artifact.1062 days = 50 random = 20 } }
				}
			}
		}
		wealth = -50
	}
	option = { # Don't repair
		name = EVTOPTBartifact.1060
		ai_chance = { factor = 0 }
	}
}
# Blacksmith repaired Raven's armor
character_event = {
	id = artifact.1061
	desc = EVTDESCartifact.1061
	picture = GFX_evt_market
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1061
		clr_global_flag = repairing_ravens_armor
		add_artifact = ravens_armor
		set_global_flag = ravens_armor_exists
	}
}
# Blacksmith couldn't repair Raven's armor
character_event = {
	id = artifact.1062
	desc = EVTDESCartifact.1062
	picture = GFX_evt_market
	
	
	is_triggered_only = yes
	
	option = { # Find better blacksmith
		name = EVTOPTAartifact.1062
		set_global_flag = repairing_ravens_armor
		custom_tooltip = {
			text = repair_ravens_armor_second_try
			hidden_tooltip = {
				random_list = {
					80 = { character_event = { id = artifact.1063 days = 50 random = 20 } }
					20 = { character_event = { id = artifact.1064 days = 50 random = 20 } }
				}
			}
		}
		wealth = -100
		ai_chance = { factor = 0 }
	}
	option = { # Execute current blacksmith better blacksmith
		name = EVTOPTBartifact.1062
		set_global_flag = repairing_ravens_armor
		random = {
			chance = 20
			add_trait = wroth
			hidden_tooltip = { character_event = { id = 38254 } }
		}
		custom_tooltip = {
			text = repair_ravens_armor_second_try
			hidden_tooltip = {
				random_list = {
					85 = { character_event = { id = artifact.1063 days = 70 random = 20 } }
					25 = { character_event = { id = artifact.1064 days = 70 random = 20 } }
				}
			}
		}
		wealth = -100
		ai_chance = { factor = 0 }
	}
	option = { # Don't repair
		name = EVTOPTCartifact.1062
		clr_global_flag = repairing_ravens_armor
	}
}
# Second blacksmith repaired Raven's armor
character_event = {
	id = artifact.1063
	desc = EVTDESCartifact.1063
	picture = GFX_evt_market
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1063
		clr_global_flag = repairing_ravens_armor
		add_artifact = ravens_armor
		set_global_flag = ravens_armor_exists
	}
}
# Second blacksmith couldn't repair Raven's armor
character_event = {
	id = artifact.1064
	desc = EVTDESCartifact.1064
	picture = GFX_evt_market
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAartifact.1064
		clr_global_flag = repairing_ravens_armor
	}
}

################################################
# Nehalenias' Mirror
################################################
# Bought Nehalenias' Mirror from old fortune-teller
character_event = {
	id = artifact.1070
	desc = EVTDESCartifact.1070
	picture = GFX_evt_market
	
	only_rulers = yes
	min_age = 15
	capable_only = yes
	
	is_triggered_only = yes # Disabled - artifacts generated via artifact_spawns
	
	trigger = {
		NOT = { has_artifact =  nehalenias_mirror }
		wealth = 100
	}
	
	mean_time_to_happen = {
		months = 8000
		modifier = { factor = 0.5 wealth = 300 }
		modifier = { factor = 0.5 wealth = 600 }
		modifier = { factor = 0.5 wealth = 900 }
		modifier = { factor = 0.9 trait = charitable }
		modifier = { factor = 0.9 trait = trusting }
		modifier = { factor = 1.5 trait = paranoid }
		modifier = { factor = 1.5 trait = greedy }
	}
	
	option = {
		name = EVTOPTAartifact.1070
		add_artifact = nehalenias_mirror
		wealth = -100
	}
	option = {
		name = EVTOPTBartifact.1070
		ai_chance = { factor = 0 }
	}
}

################################################
# Seeing Stone
################################################
# Bought Seeing Stone
character_event = {
	id = artifact.1080
	desc = EVTDESCartifact.1080
	picture = GFX_evt_throne_room
	
	only_rulers = yes
	min_age = 15
	capable_only = yes
	
	is_triggered_only = yes # Disabled - artifacts generated via artifact_spawns
	
	trigger = {
		NOT = { has_artifact =  seeing_stone }
		wealth = 100
	}
	
	mean_time_to_happen = {
		months = 8000
		modifier = { factor = 0.5 wealth = 300 }
		modifier = { factor = 0.5 wealth = 600 }
		modifier = { factor = 0.5 wealth = 900 }
		modifier = { factor = 0.9 trait = charitable }
		modifier = { factor = 0.9 trait = trusting }
		modifier = { factor = 1.5 trait = paranoid }
		modifier = { factor = 1.5 trait = greedy }
	}
	
	option = {
		name = EVTOPTAartifact.1080
		add_artifact = seeing_stone
		wealth = -100
	}
	option = {
		name = EVTOPTBartifact.1080
		ai_chance = { factor = 0 }
	}
}

################################################
# Sephirah - ways to get somewhat similar to how they are gotten in game
################################################
# Chocc'mah - Gotten if alchemist
# Ghe'vrath, 'Oth, Veen'ah - Gotten if Melitele follower
# Keth'aar - Gotten if own a city
# Kezath - Gotten if own a province with swamp terrain
# Maal'kad - Gotten if have monster infestation
# Neh'tza - Gotten anywhere
# Tipperath - Gotten if merchant
# Y'esath - Gotten if own a province with mountain terrain
