namespace = camelot_event

###Merlin arrives###
narrative_event = {
	id = camelot_event.0001
	title = "EVTNAMEcamelot_event.0001"
	desc = "EVTDESCcamelot_event.0001"
	picture = GFX_evt_library
	
	prisoner = no
	capable_only = yes
	
	trigger = {
		is_alive = yes
		OR = {
			culture_group = west_germanic
			culture_group = celtic
		}
		NOT = { culture = pictish }
		NOT = { culture = scottish }
		OR = {
			has_character_flag = formed_kingdom_of_britian
			AND = {
				learning = 10
				diplomacy = 10
				OR = {
					any_demesne_title = { title = k_britain }
					AND = {
						any_demesne_title = { title = d_cornwall }
						prestige = 5000
						learning = 15
					}
				}
			}
		}
		OR = {
			ai = no
			has_game_rule = {
				name = supernatural_events
				value = unrestricted
			}
		}
		NOR = {
			has_game_rule = {
				name = supernatural_events
				value = off
			}
			has_global_flag = merlin_appeared
		}
	}
	
	mean_time_to_happen = {
		years = 20
		modifier = {
			factor = 0.5 # Increases chances by half
			OR = {
				trait = genius
				trait = quick
			}
		}
		modifier = {
			factor = 0.75 # Increases chances by one forth
			OR = {
				trait = diligent
				trait = patient
				trait = gregarious
			}
		}
		modifier = {
			factor = 4 # Decreases chances by four times
			OR = {
				trait = imbecile
				trait = lunatic
				trait = possessed
				trait = mystic
			}
		}
		modifier = {
			factor = 2 # Decreases chances by half
			OR = {
				trait = slow
				trait = inbred
				trait = blinded
				trait = eunuch
				trait = maimed
			}
		}
		modifier = {
			factor = 1.5 # Decreases chances by one forth
			OR = {
				trait = craven
				trait = shy
				trait = cruel
				trait = depressed
				trait = stressed
			}
		}
	}
	
	immediate = {set_global_flag = merlin_appeared}
	
	option = {
		name = "EVTOPTAcamelot_event.0001"
		ai_chance = { factor = 5 }
		hidden_tooltip = {
			narrative_event = {
				camelot_event.0007
				days = 1800
			}
		}
		if = {
			limit = { culture_group = celtic }
			create_character = {
				random_traits = no
				dynasty = none
				historical = yes
				name = "Myrddin"
				religion = ROOT
				culture = welsh
				female = no
				age = 50
				attributes = {
					martial = 6
					diplomacy = 10
					stewardship = 8
					intrigue = 4
					learning = 16
				}
				health = 12
				fertility = 0.8
				trait = mastermind_theologian
				trait = human_trait
				trait = scholar
				trait = wizard
				trait = sympathy_elves
				trait = temperate
				trait = patient
				trait = chaste
				trait = proud
			}
			new_character = {
				set_character_flag = is_merlin
				dynasty = 9990002

				give_nickname = nick_the_great
				save_event_target_as = true_merlin
			}
		}
		if = {
			limit = { 
				NOT = { culture_group = celtic }
			}
			create_character = {
				random_traits = no
				dynasty = none
				historical = yes
				name = "Merlin"
				religion = ROOT
				culture = saxon
				female = no
				age = 50
				attributes = {
					martial = 4
					diplomacy = 10
					stewardship = 8
					intrigue = 6
					learning = 16
				}
				health = 12
				fertility = 0.8
				trait = mastermind_theologian
				trait = human_trait
				trait = scholar
				trait = wizard
				trait = sympathy_elves
				trait = temperate
				trait = patient
				trait = chaste
				trait = proud
			}
			new_character = {
				set_character_flag = is_merlin
				dynasty = 9990001

				give_nickname = nick_the_great
				save_event_target_as = true_merlin
			}
		}
	}
	option = {
		name = "EVTOPTBcamelot_event.0001"
		tooltip_info = zealous
		trigger = {
			trait = zealous
		}
		ai_chance = { factor = 10 }
		wealth = 100
		custom_tooltip = { text = merlin_killed_tooltip }
		set_global_flag = merlin_killed
	}
}

###Morgana appears###
narrative_event = {
	id = camelot_event.0002
	title = "EVTNAMEcamelot_event.0002"
	desc = "EVTDESCcamelot_event.0002"
	picture = GFX_evt_throne_room
	
	prisoner = no
	capable_only = yes
	
	trigger = {
		OR = {
			culture = pictish
			culture = scottish
		}
		any_playable_ruler = {
			has_landed_title = k_avalon
		}
		is_landed = yes
		has_global_flag = merlin_appeared
		NOT = { has_global_flag = merlin_killed }
		OR = {
			ai = no
			has_game_rule = {
				name = supernatural_events
				value = unrestricted
			}
		}
		NOR = {
			has_game_rule = {
				name = supernatural_events
				value = off
			}
			has_global_flag = morgana_appeared
		}
	}
	
	mean_time_to_happen = {
		months = 4
		modifier = {
			factor = 0.5 # Increases chances by half
			OR = {
				trait = genius
				trait = quick
			}
		}
		modifier = {
			factor = 0.75 # Increases chances by one forth
			OR = {
				trait = diligent
				trait = patient
				trait = gregarious
			}
		}
		modifier = {
			factor = 4 # Decreases chances by four times
			OR = {
				trait = imbecile
				trait = lunatic
				trait = possessed
				trait = mystic
			}
		}
		modifier = {
			factor = 2 # Decreases chances by half
			OR = {
				trait = slow
				trait = inbred
				trait = blinded
				trait = eunuch
				trait = maimed
			}
		}
		modifier = {
			factor = 1.5 # Decreases chances by one forth
			OR = {
				trait = craven
				trait = shy
				trait = cruel
				trait = depressed
				trait = stressed
			}
		}
	}
	
	immediate = { set_global_flag = morgana_appeared }
	
	option = {
		name = "EVTOPTAcamelot_event.0002"
		ai_chance = { factor = 5 }
		if = {
			limit = { culture = pictish }
			create_character = {
				random_traits = no
				historical = yes
				name = "Morgen"
				dynasty = none
				religion = ROOT
				culture = pictish
				female = yes
				age = 30
				attributes = {
					martial = 8
					diplomacy = 4
					stewardship = 6
					intrigue = 10
					learning = 14
				}
				health = 12
				fertility = 0.4
				trait = mastermind_theologian
				trait = human_trait
				trait = scholar
				trait = sorcerer
				trait = scarred
				trait = wroth
				trait = greedy
				trait = chaste
				trait = proud
				trait = cruel
				flag = is_morgana
			}
			new_character = {
				set_character_flag = is_morgana
				dynasty = 9990004

				save_event_target_as = true_morgana
			}
		}
		if = {
			limit = { 
				NOT = { culture = pictish }
			}
			create_character = {
				random_traits = no
				historical = yes
				name = "Morgan"
				dynasty = none
				religion = ROOT
				culture = scottish
				female = yes
				age = 30
				attributes = {
					martial = 8
					diplomacy = 4
					stewardship = 6
					intrigue = 10
					learning = 14
				}
				health = 12
				fertility = 0.4
				trait = mastermind_theologian
				trait = human_trait
				trait = scholar
				trait = sorcerer
				trait = scarred
				trait = wroth
				trait = greedy
				trait = chaste
				trait = proud
				trait = cruel
			}
			new_character = {
				set_character_flag = is_morgana
				dynasty = 9990003

				save_event_target_as = true_morgana
			}
		}
	}
	option = {
		name = "EVTOPTBcamelot_event.0002"
		tooltip_info = zealous
		trigger = {
			trait = zealous
		}
		ai_chance = { factor = 10 }
		wealth = 100
		custom_tooltip = { text = morgana_killed_tooltip }
		set_global_flag = morgana_killed
	}
}

###Merlin takes an apprentice###
character_event = {
	id = camelot_event.0003
	desc = "EVTDESCcamelot_event.0003"
	picture = GFX_evt_guardian
	
	trigger = {
		has_character_flag = is_merlin
		NOT = { has_character_flag = took_apprentice }
		OR = {
			any_child = {
				age = 6
				NOT = { age = 12 }
				is_alive = yes
				is_ruler = no
				prisoner = no
			}
			top_liege = {
				any_child = {
					age = 6
					NOT = { age = 12 }
					is_alive = yes
					is_ruler = no
					prisoner = no
				}
			}
		}
	}
	
	mean_time_to_happen = {
		years = 1
	}
	
	option = {
		name = "EVTOPTAcamelot_event.0003"
		if = {
			limit = {
				any_child = {
					age = 6
					NOT = { age = 12 }
					is_alive = yes
					is_ruler = no
					prisoner = no
				}
			}
			random_child = {
				limit = {
					age = 6
					NOT = { age = 12 }
					is_alive = yes
					is_ruler = no
					prisoner = no
				}
				set_guardian = ROOT
				add_trait = apprentice_wizard
			}
			set_character_flag = took_apprentice
			#break = yes
		}
	}
	option = {
		name = "EVTOPTBcamelot_event.0003"
		top_liege = {
			letter_event = { id = camelot_event.0004 }
		}
	}
}

###Merlin asks liege to take an apprentice###
letter_event = {
	id = camelot_event.0004
	desc = "EVTDESCcamelot_event.0004"
	picture = GFX_evt_council
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTAcamelot_event.0004"
		trigger = {
			any_child = {
				age = 6
				NOT = { age = 12 }
				is_alive = yes
				is_ruler = no
				prisoner = no
			}
		}
		ai_chance = { 
			factor = 5
			modifier = {
				factor = 1
				OR = {
					trait = proud
					trait = zealous
				}
			}
			modifier = {
				factor = 10
				OR = {
					trait = genius
					trait = quick
				}
			}
		}
		random_child = {
			limit = {
				age = 6
				NOT = { age = 12 }
				is_alive = yes
				is_ruler = no
				prisoner = no
			}
			set_guardian = FROM
			add_trait = apprentice_wizard
		}
		FROM = { set_character_flag = took_apprentice }
		prestige = -50
	}
	option = {
		name = "EVTOPTBcamelot_event.0004"
		ai_chance = { 
			factor = 10
			modifier = {
				factor = 15
				OR = {
					trait = proud
					trait = zealous
				}
			}
			modifier = {
				factor = 2
				OR = {
					trait = genius
					trait = quick
				}
			}
		}
		opinion = {
			modifier = opinion_denied_guardianship
			who = FROM
			months = 24
		}
		prestige = 50
	}
}

###Morgana takes an apprentice###
character_event = {
	id = camelot_event.0005
	desc = "EVTDESCcamelot_event.0005"
	picture = GFX_evt_guardian
	
	trigger = {
		has_character_flag = is_morgana
		NOT = { has_character_flag = took_apprentice }
		OR = {
			any_child = {
				age = 6
				NOT = { age = 12 }
				is_alive = yes
				is_ruler = no
				prisoner = no
			}
			top_liege = {
				any_child = {
					age = 6
					NOT = { age = 12 }
					is_alive = yes
					is_ruler = no
					prisoner = no
				}
			}
		}
	}
	
	mean_time_to_happen = {
		years = 1
	}
	
	option = {
		name = "EVTOPTAcamelot_event.0005"
		if = {
			limit = {
				any_child = {
					age = 6
					NOT = { age = 12 }
					is_alive = yes
					is_ruler = no
					prisoner = no
				}
			}
			random_child = {
				limit = {
					age = 6
					NOT = { age = 12 }
					is_alive = yes
					is_ruler = no
					prisoner = no
				}
				set_guardian = ROOT
				add_trait = apprentice_sorcerer
			}
			set_character_flag = took_apprentice
			#break = yes
		}
	}
	option = {
		name = "EVTOPTBcamelot_event.0005"
		top_liege = {
			letter_event = { id = camelot_event.0006 }
		}
	}
}

###Morgana asks liege to take an apprentice###
letter_event = {
	id = camelot_event.0006
	desc = "EVTDESCcamelot_event.0006"
	picture = GFX_evt_council
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTAcamelot_event.0006"
		trigger = {
			any_child = {
				age = 6
				NOT = { age = 12 }
				is_alive = yes
				is_ruler = no
				prisoner = no
			}
		}
		ai_chance = { 
			factor = 5
			modifier = {
				factor = 1
				OR = {
					trait = proud
					trait = zealous
				}
			}
			modifier = {
				factor = 10
				OR = {
					trait = genius
					trait = quick
				}
			}
		}
		random_child = {
			limit = {
				age = 6
				NOT = { age = 12 }
				is_alive = yes
				is_ruler = no
				prisoner = no
			}
			set_guardian = FROM
			add_trait = apprentice_wizard
		}
		FROM = { set_character_flag = took_apprentice }
		prestige = -50
	}
	option = {
		name = "EVTOPTBcamelot_event.0006"
		ai_chance = { 
			factor = 10
			modifier = {
				factor = 15
				OR = {
					trait = proud
					trait = zealous
				}
			}
			modifier = {
				factor = 2
				OR = {
					trait = genius
					trait = quick
				}
			}
		}
		opinion = {
			modifier = opinion_denied_guardianship
			who = FROM
			months = 24
		}
		prestige = 50
	}
}

###Lady of the lake rumors###
narrative_event = {
	id = camelot_event.0007
	title = "EVTNAMEcamelot_event.0007"
	desc = "EVTDESCcamelot_event.0007"
	picture = GFX_evt_market
	
	prisoner = no
	capable_only = yes
	
	hide_from = yes
	
	trigger = {
		is_alive = yes
		OR = {
			culture_group = west_germanic
			culture_group = celtic
		}
		NOT = { culture = pictish }
		NOT = { culture = scottish }
		OR = {
			has_character_flag = formed_kingdom_of_britian
			AND = {
				martial = 10
				diplomacy = 10
				any_demesne_title = { title = k_britain }
				#any_playable_ruler = { has_landed_title = k_avalon }
				is_landed = yes
			}
		}
		NOT = { has_artifact = excalibur }
		any_courtier_or_vassal = {
			liege = { character = ROOT }
			has_minor_title = title_court_mage
		}
		NOT = { has_global_flag = lotl_found }
		NOT = { has_character_flag = lotl_rumors }
		OR = {
			ai = no
			has_game_rule = {
				name = supernatural_events
				value = unrestricted
			}
		}
		NOT = {
			has_game_rule = {
				name = supernatural_events
				value = off
			}
		}
	}
	
	mean_time_to_happen = {
		years = 10
		modifier = {
			factor = 0.25 # Increases chances by three forths
			has_character_flag = formed_kingdom_of_britian
		}
		modifier = {
			factor = 0.5 # Increases chances by half
			OR = {
				trait = genius
				trait = strong
			}
		}
		modifier = {
			factor = 0.75 # Increases chances by one forth
			OR = {
				trait = diligent
				trait = patient
				trait = gregarious
			}
		}
		modifier = {
			factor = 4 # Decreases chances by four times
			OR = {
				trait = imbecile
				trait = lunatic
				trait = possessed
			}
		}
		modifier = {
			factor = 2 # Decreases chances by half
			OR = {
				trait = slow
				trait = inbred
				trait = blinded
				trait = eunuch
				trait = maimed
			}
		}
		modifier = {
			factor = 1.5 # Decreases chances by one forth
			OR = {
				trait = craven
				trait = shy
				trait = cruel
				trait = depressed
				trait = stressed
			}
		}
	}
	
	immediate = { set_character_flag = lotl_rumors }
	
	option = {
		name = "EVTOPTAcamelot_event.0007"
		ai_chance = { factor = 5 }
		narrative_event = {
			id = camelot_event.0008
			days = 30
			random = 30
			tooltip = lotl_search_tooltip
		}
	}
	
	option = {
		name = "EVTOPTBcamelot_event.0007"
		tooltip_info = cynical
		trigger = {
			trait = cynical
		}
		ai_chance = { factor = 10 }
	}
}

###Research the lady of the lake###
narrative_event = {
	id = camelot_event.0008
	title = "EVTNAMEcamelot_event.0008"
	desc = "EVTDESCcamelot_event.0008"
	picture = GFX_evt_library
	
	hide_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTAcamelot_event.0008"
		ai_chance = { factor = 5 }
		narrative_event = {
			id = camelot_event.0009
			days = 15
			random = 15
			tooltip = begin_lotl_search_tooltip
		}
	}
	
	option = {
		name = "EVTOPTBcamelot_event.0008"
		trigger = {
			OR = {
				ai = no
				trait = content
			}
		}
		ai_chance = { factor = 10 }
	}
}

###Lady of the lake search###
narrative_event = {
	id = camelot_event.0009
	title = "EVTNAMEcamelot_event.0009"
	desc = "EVTDESCcamelot_event.0009"
	picture = GFX_evt_mysterious_forest
	
	hide_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTAcamelot_event.0009"
		tooltip_info = genius
		trigger = {
			trait = genius
		}
		ai_chance = { factor = 10 }
		custom_tooltip = { text = continue_lotl_search_tooltip }
		hidden_tooltip = {
			random_list = {
				95 = {
					narrative_event = {
						id = camelot_event.0011
						days = 1
					}
				}
				5 = {
					narrative_event = {
						id = camelot_event.0010
						days = 3
					}
				}
			}
		}
	}
	option = {
		name = "EVTOPTBcamelot_event.0009"
		tooltip_info = strong
		trigger = {
			trait = strong
		}
		ai_chance = { factor = 10 }
		custom_tooltip = { text = continue_lotl_search_tooltip }
		hidden_tooltip = {
			random_list = {
				90 = {
					narrative_event = {
						id = camelot_event.0011
						days = 1
					}
				}
				10 = {
					narrative_event = {
						id = camelot_event.0010
						days = 3
					}
				}
			}
		}
	}
	option = {
		name = "EVTOPTCcamelot_event.0009"
		#if = {
		#	limit = { trait = wizard }
		#	tooltip_info = wizard
		#}
		#if = {
		#	limit = { trait = sorcerer }
		#	tooltip_info = sorcerer
		#}
		trigger = {
			OR = {
				trait = wizard
				trait = sorcerer
			}
			NOT = { trait = genius }
			NOT = { trait = strong }
		}
		ai_chance = { factor = 5 }
		custom_tooltip = { text = continue_lotl_search_tooltip }
		hidden_tooltip = {
			random_list = {
				50 = {
					narrative_event = {
						id = camelot_event.0011
						days = 1
					}
				}
				50 = {
					narrative_event = {
						id = camelot_event.0010
						days = 3
					}
				}
			}
		}
	}
	option = {
		name = "EVTOPTDcamelot_event.0009"
		ai_chance = { factor = 1 }
		custom_tooltip = { text = continue_lotl_search_tooltip }
		hidden_tooltip = {
			random_list = {
				5 = {
					narrative_event = {
						id = camelot_event.0011
						days = 1
					}
				}
				95 = {
					narrative_event = {
						id = camelot_event.0010
						days = 3
					}
				}
			}
		}
	}
}

###Failure to find the lady of the lake###
narrative_event = {
	id = camelot_event.0010
	title = "EVTNAMEcamelot_event.0010"
	desc = "EVTDESCcamelot_event.0010"
	picture = GFX_evt_sword_in_the_stone
	
	hide_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTAcamelot_event.0010"
		ai_chance = { factor = 5 }
		random_list = {
			70 = {
				add_trait = depressed
				hidden_tooltip = { character_event = { id = 38288 } }
			}
			15 = {
				add_trait = wounded
				hidden_tooltip = { character_event = { id = 38280 } }
			}
			10 = {
				add_maimed_trait_effect = yes
			}
			5 = {
				death = { death_reason = death_suicide }
			}
		}
	}
}

###Lady of the lake appears###
narrative_event = {
	id = camelot_event.0011
	title = "EVTNAMEcamelot_event.0011"
	desc = "EVTDESCcamelot_event.0011"
	picture = GFX_evt_sword_in_the_stone
	
	is_triggered_only = yes
	
	hide_from = yes
	
	immediate = {
		set_global_flag = lotl_found
		set_character_flag = claimed_excalibur
	}
	
	option = {
		name = "EVTOPTAcamelot_event.0011"
		ai_chance = { factor = 10 }
		add_artifact = excalibur
		new_artifact = {
			set_creation_date = -1.1.1
		}
		add_to_bloodline = king_arthur_bloodline
		hidden_tooltip = {
			any_dynasty_member = {
				limit = { is_ancestor_of = ROOT }
				add_to_bloodline = king_arthur_bloodline
			}
		}
	}
	
	option = {
		name = "EVTOPTBcamelot_event.0011"
		ai_chance = { factor = 1 }
		add_artifact = excalibur
		new_artifact = {
			set_creation_date = -1.1.1
		}
		add_to_bloodline = king_arthur_bloodline
		hidden_tooltip = {
			any_dynasty_member = {
				limit = { is_ancestor_of = ROOT }
				add_to_bloodline = king_arthur_bloodline
			}
		}
		create_character = {
			random_traits = no
			historical = yes
			name = "Lady of the Lake"
			dna = dcudmnclwpu
			dynasty = none
			religion = ROOT
			culture = ethereal
			female = yes
			age = 116
			health = 50
			attributes = {
				martial = 1
				diplomacy = 12
				stewardship = 10
				intrigue = 3
				learning = 18
			}
			trait = mastermind_theologian
			trait = undead_trait
			trait = wizard
			trait = immortal
			trait = sympathy_elves
			trait = temperate
			trait = patient
			trait = chaste
			trait = charitable
			trait = fair
		}
		new_character = {
			set_character_flag = is_lotl

			will_not_marry_effect = yes

			save_event_target_as = true_lotl
		}
		set_global_flag = lotl_appeared
	}
}

###Excalibur inheritince event###
character_event = {
	id = camelot_event.0012
	desc = "EVTDESCcamelot_event.0012"
	picture = GFX_evt_lady_of_the_lake
	
	is_triggered_only = yes
	
	option = {
		name = "EVTOPTAcamelot_event.0012"
		tooltip_info = genius
		trigger = {
			trait = genius
			NOT = { trait = strong }
		}
		random_list = {
			95 = {
				custom_tooltip = { text = claimed_excalibur_tooltip }
				set_character_flag = claimed_excalibur
			}
			5 = {
				add_trait = stressed
				if = {
					limit = { 
						any_character = { has_character_flag = is_lotl }
					}
					custom_tooltip = { text = lotl_leaves_tooltip }
					hidden_tooltip = {
						event_target:true_lotl = { leave_court_and_die_effect = yes }
					}
				}
			}
		}
	}
	
	option = {
		name = "EVTOPTAcamelot_event.0012"
		tooltip_info = strong
		trigger = {
			NOT = { trait = genius }
			trait = strong
		}
		random_list = {
			90 = {
				custom_tooltip = { text = claimed_excalibur_tooltip }
				set_character_flag = claimed_excalibur
			}
			7 = {
				add_trait = stressed
				if = {
					limit = { 
						any_character = { has_character_flag = is_lotl }
					}
					custom_tooltip = { text = lotl_leaves_tooltip }
					hidden_tooltip = {
						event_target:true_lotl = { leave_court_and_die_effect = yes }
					}
				}
			}
			3 = {
				add_trait = wounded
				hidden_tooltip = { character_event = { id = 38280 } }
				if = {
					limit = { 
						any_character = { has_character_flag = is_lotl }
					}
					custom_tooltip = { text = lotl_leaves_tooltip }
					hidden_tooltip = {
						event_target:true_lotl = { leave_court_and_die_effect = yes }
					}
				}
			}
		}
	}
	option = {
		name = "EVTOPTAcamelot_event.0012"
		trigger = {
			NOT = { trait = genius }
			NOT = { trait = strong }
		}
		random_list = {
			50 = {
				custom_tooltip = { text = claimed_excalibur_tooltip }
				set_character_flag = claimed_excalibur
			}
			35 = {
				add_trait = stressed
				if = {
					limit = { 
						any_character = { has_character_flag = is_lotl }
					}
					custom_tooltip = { text = lotl_leaves_tooltip }
					hidden_tooltip = {
						event_target:true_lotl = { leave_court_and_die_effect = yes }
					}
				}
			}
			15 = {
				add_trait = wounded
				hidden_tooltip = { character_event = { id = 38280 } }
				if = {
					limit = { 
						any_character = { has_character_flag = is_lotl }
					}
					custom_tooltip = { text = lotl_leaves_tooltip }
					hidden_tooltip = {
						event_target:true_lotl = { leave_court_and_die_effect = yes }
					}
				}
			}
		}
	}
}

###Camelot Discovered###
narrative_event = {
	id = camelot_event.0013
	title = "EVTNAMEcamelot_event.0013"
	desc = "EVTDESCcamelot_event.0013"
	picture = GFX_evt_magnificent_castle
	
	capable_only = yes
	
	trigger = {
		age = 16
		any_demesne_title = { title = c_gwent }
		NOT = { has_global_flag = lotl_left }
		has_character_flag = claimed_excalibur
		NOT = { has_global_flag = camelot_discovered }
	}
	
	mean_time_to_happen = {
		years = 50
		modifier = {
			factor = 0.5 # Increases chances by half
			OR = {
				trait = genius
				trait = quick
			}
		}
		modifier = {
			factor = 0.75 # Increases chances by one forth
			OR = {
				trait = diligent
				trait = patient
				trait = gregarious
			}
		}
		modifier = {
			factor = 4 # Decreases chances by four times
			OR = {
				trait = imbecile
				trait = lunatic
				trait = possessed
				trait = mystic
			}
		}
		modifier = {
			factor = 2 # Decreases chances by half
			OR = {
				trait = slow
				trait = inbred
				trait = blinded
				trait = eunuch
				trait = maimed
			}
		}
		modifier = {
			factor = 1.5 # Decreases chances by one forth
			OR = {
				trait = craven
				trait = shy
				trait = cruel
				trait = depressed
				trait = stressed
			}
		}
	}

	option = {
		name = "EVTOPTAcamelot_event.0013"
		ai_chance = { factor = 90 }
		wealth = -200
		set_global_flag = camelot_discovered
		20 = {
			wonder = {
				set_name = wonder_fortress_camelot
				hidden_tooltip = { set_description = wonder_fortress_camelot_desc }
			}
			add_holding_slot = 1
		}	
	}
	option = {
		name = "EVTOPTBcamelot_event.0013"
		ai_chance = { factor = 10 }
		custom_tooltip = { text = camelot_may_take_long_time }
	}
}

###AI event troops###
character_event = {
	id = camelot_event.0014
	hide_window = yes
	
	is_triggered_only = yes
	
	trigger = {
		NOT = {
			has_game_rule = {
				name = boost_magic
				value = off
			}
		}
		OR = {
			has_game_rule = {
				name = boost_magic
				value = on
			}
			ai = yes
		}
		has_landed_title = d_cornwall
		independent = yes
	}

	option = {
		name = OK
		c_somerset = { add_claim = PREV }
		c_dorset = { add_claim = PREV }
		location = {
			ROOT = {
				spawn_unit = {
					province = PREV
					owner = ROOT
					home = ROOT
					troops = {
						archers = { 200 200 }
						light_infantry = { 1000 1000 }
					}
					attrition = 0
					cannot_inherit = yes
					maintenance_multiplier = 0
				}
			}
		}
	}
}