namespace = NEOW_religious_decision

NEOW_religious_decision.0001 = { #custom patron gods for Leviathan
	type = character_event
	title = NEOW_religious_decision.0001.t
	desc = NEOW_religious_decision.0001.desc
	theme = faith
	left_portrait = {
		character = root
		animation = personality_rational
	}

	option = {
		name = NEOW_religious_decision.0001.nationalisators
		trigger = {
			NOT = { has_character_modifier = bhakti_leviathan_nationalisators }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_leviathan_nationalisators }
	}

	option = {
		name = NEOW_religious_decision.0001.technosaurs
		trigger = {
			NOT = { has_character_modifier = bhakti_leviathan_technosaurs }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_leviathan_technosaurs }
	}

	option = {
		name = NEOW_religious_decision.0001.mechasaurs
		trigger = {
			NOT = { has_character_modifier = bhakti_leviathan_mechasaurs }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_leviathan_mechasaurs }
	}

	option = {
		name = NEOW_religious_decision.0001.petrosaurs
		trigger = {
			NOT = { has_character_modifier = bhakti_leviathan_petrosaurs }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_leviathan_petrosaurs }
	}

	option = {
		name = NEOW_religious_decision.0001.metallurgicals
		trigger = {
			NOT = { has_character_modifier = bhakti_leviathan_metallurgicals }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_leviathan_metallurgicals }
	}
	
	option = {
		name = NEOW_religious_decision.0001.nautiluses
		trigger = {
			NOT = { has_character_modifier = bhakti_leviathan_nautiluses }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_leviathan_nautiluses }
	}

	option = {
		name = NEOW_religious_decision.0001.aerosaurs
		trigger = {
			NOT = { has_character_modifier = bhakti_leviathan_aerosaurs }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_leviathan_aerosaurs }
	}

	# Opt-Out
	option = {
		name = NEOW_religious_decision.0001.optout
		flavor = NEOW_religious_decision.0001.flavor

		ai_chance = {
			base = 0
		}
	}
}

NEOW_religious_decision.0103 = { #custom patron gods for Leviathan
	type = character_event
	title = NEOW_religious_decision.0103.t
	desc = NEOW_religious_decision.0103.desc
	theme = faith
	left_portrait = {
		character = root
		animation = personality_rational
	}

	option = {
		name = NEOW_religious_decision.0103.jesus
		trigger = {
			NOT = { has_character_modifier = bhakti_folketero_jesus }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_folketero_jesus }
	}

	option = {
		name = NEOW_religious_decision.0103.per
		trigger = {
			NOT = { has_character_modifier = bhakti_folketero_per }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_folketero_per }
	}

	option = {
		name = NEOW_religious_decision.0103.lucia
		trigger = {
			NOT = { has_character_modifier = bhakti_folketero_lucia }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_folketero_lucia }
	}

	option = {
		name = NEOW_religious_decision.0103.olaf
		trigger = {
			NOT = { has_character_modifier = bhakti_folketero_olaf }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_folketero_olaf }
	}

	# Opt-Out
	option = {
		name = NEOW_religious_decision.0001.optout
		flavor = NEOW_religious_decision.0001.flavor

		ai_chance = {
			base = 0
		}
	}
}

NEOW_religious_decision.0104 = { #custom icons for orthodoxy
	type = character_event
	title = NEOW_religious_decision.0104.t
	desc = NEOW_religious_decision.0104.desc
	theme = faith
	left_portrait = {
		character = root
		animation = personality_rational
	}

	option = {
		name = NEOW_religious_decision.0104.paisos
		trigger = {
			NOT = { has_character_modifier = bhakti_orthodox_paisos }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_orthodox_paisos}
	}

	option = {
		name = NEOW_religious_decision.0104.gabriel
		trigger = {
			NOT = { has_character_modifier = bhakti_orthodox_gabriel }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_orthodox_gabriel }
	}

	option = {
		trigger = { is_vaguely_nistrenian_bhakti_trigger = yes }	
		name = NEOW_religious_decision.0104.adriana
		trigger = {
			NOT = { has_character_modifier = bhakti_orthodox_adriana }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_orthodox_adriana }
	}

	option = {
		trigger = { is_vaguely_nistrenian_bhakti_trigger = no }	
		name = NEOW_religious_decision.0104.olga
		trigger = {
			NOT = { has_character_modifier = bhakti_orthodox_olga }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_orthodox_olga }
	}

	option = {
		name = NEOW_religious_decision.0104.palamas
		trigger = {
			NOT = { has_character_modifier = bhakti_orthodox_palamas }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_orthodox_palamas }
	}
	option = {
		name = NEOW_religious_decision.0104.surgeon
		trigger = {
			NOT = { has_character_modifier = bhakti_orthodox_surgeon }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_orthodox_surgeon }
	}

	option = {
		name = NEOW_religious_decision.0104.lazar
		trigger = {
			NOT = { has_character_modifier = bhakti_orthodox_lazar }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_orthodox_lazar }
	}

	option = {
		name = NEOW_religious_decision.0104.theotokos
		trigger = {
			NOT = { has_character_modifier = bhakti_orthodox_theotokos }
		}
		NEOW_set_bhakti_effect = { BHAKTI = bhakti_orthodox_theotokos }
	}
	# Opt-Out
	option = {
		name = NEOW_religious_decision.0001.optout
		flavor = NEOW_religious_decision.0001.flavor

		ai_chance = {
			base = 0
		}
	}
}


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
		#	}
		}
	}
}