namespace = novelist_decisions

novelist_decisions.0001 = {
	type = character_event
	title = novelist_decisions.0001.t
	desc = novelist_decisions.0001.desc
	theme = faith
	left_portrait = {
		character = scope:scoped_ruler
		animation = personality_zealous
	}
	right_portrait = {
		character = scope:new_priest
		animation = happiness
	}

	immediate = {
		play_music_cue = "mx_cue_faith_conversion"
		save_scope_as = scoped_ruler
		if = { #remove the HoF blocker for all novelist faiths
			limit = {
				religion = {
					any_faith = { has_doctrine = special_doctrine_not_allowed_to_hof }
				}
			}
			religion = {
				every_faith = {
					limit = {
						has_doctrine = special_doctrine_not_allowed_to_hof
					}
					remove_doctrine = special_doctrine_not_allowed_to_hof
				}
			}
		}
		if = { # Check if Temporal first.
			limit = {
				faith = { has_doctrine = doctrine_temporal_head }
			}
			save_scope_as = new_priest
		}
		else_if = { # Pick your chaplain first.
			limit = {
				exists = cp:councillor_court_chaplain
				cp:councillor_court_chaplain = { faith = scope:scoped_ruler.faith }
			}
			cp:councillor_court_chaplain = { save_scope_as = new_priest }
		}
		else = {
			hidden_effect = {
				create_character = {
					employer = root
					template = religious_leader_character
					random_traits = no
					save_scope_as = new_priest
					dynasty = generate
				}
			}
			scope:new_priest = {
				add_trait = education_learning_3
				add_trait = zealous
				add_trait = intellect_good_1
				random_list = {
					1 = { add_trait = lustful }
					1 = { add_trait = chaste }
					1 = { add_trait = wrathful }
					1 = { add_trait = diligent }
					1 = { add_trait = impatient }
					1 = { add_trait = arrogant }
					1 = { add_trait = humble }
					1 = { add_trait = gregarious }
				}
				random_list = {
					1 = { add_trait = honest }
					1 = { add_trait = ambitious }
					1 = { add_trait = just }
					1 = { add_trait = cynical }
					1 = { add_trait = zealous }
					1 = { add_trait = compassionate }
					1 = { add_trait = stubborn }
				}
			}
		}
		create_title_and_vassal_change = {
			type = created
			save_scope_as = change
			add_claim_on_loss = no
		}
		root.faith.religious_head_title = {
			change_title_holder = {
				holder = scope:new_priest
				change = scope:change
			}
		}
		resolve_title_and_vassal_change = scope:change
	}

	option = {
		name = novelist_decisions.0001.a
		add_prestige = major_prestige_gain
		add_piety = major_piety_gain
		faith = {
			change_fervor = {
				value = 10
				desc = fervor_gain_priesthood_recreated
			}
		}
		if = { # Vassalize if possible/needed.
			limit = {
				highest_held_title_tier > scope:new_priest.highest_held_title_tier
				NOT = { scope:new_priest = { any_liege_or_above = { this = root } } }
			}
			create_title_and_vassal_change = {
				type = created
				save_scope_as = change
				add_claim_on_loss = no
			}
			scope:new_priest = {
				change_liege = {
					liege = root
					change = scope:change
				}
			}
			resolve_title_and_vassal_change = scope:change
		}
		#create_legend_seed = {
		#	type = holy
		#	quality = famed
		#	chronicle = priesthood_restoration
		#	properties = {
		#		founder = scope:new_priest
		#		faith = scope:new_priest.faith
		#		religion = scope:new_priest.religion
		#	}
		#}
		#hidden_effect = {
		#	every_player = {
		#		limit = {
		#			this != root
		#			OR = {
		#				faith.religion = root.faith.religion
		#				AND = {
		#					is_landed = yes
		#					capital_province = {
		#						OR = {
		#							geographical_region = world_middle_east
		#							geographical_region = world_persian_empire
		#						}
		#					}
		#				}
		#			}
		#		}
		#		trigger_event = middle_east_decisions.0010
		#	}
		#}
	}
}