decisions = {	

	restore_luxor = {
		is_high_prio = yes
		ai_check_interval = 12
		only_playable = yes
		only_independent = yes
		potential = {
			is_playable = yes	
			independent = yes
			higher_tier_than = duke
			OR = {
				religion = egyptian_pagan
				religion = aten_pagan
			}
			NOT = { has_global_flag = luxor_restored }
			NOT = { has_global_flag = luxor_restoring }
		}	
		allow = {
			wealth = 1000
			795 = {
				owner = {
					character = ROOT
				}
			}
			war = no
			has_regent = no		
		}
		effect = {
			set_global_flag = luxor_restoring
			wealth = -1000
			795 = {
				province_event = { id = ancrel.4000 }
			}
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0
				NOT = {
					wealth = 1500
				}
			}
			modifier = {
				factor = 0
				NOT = {
					learning = 8
				}
			}
		}
	}

	build_pyramid = {
		is_high_prio = yes
		only_playable = yes
		ai_check_interval = 12
		potential = {
			is_playable = yes
			higher_tier_than = duke
			OR = {
				religion = egyptian_pagan
				religion = aten_pagan
			}
			NOT = { 
				has_character_flag = pyramid_built
				has_character_flag = pyramid_building_char
				capital_scope = { has_province_flag = pyramid_building_prov }
			}
		}
		allow = {
			wealth = 600
			war = no
			has_regent = no		
		}
		effect = {
			set_character_flag = pyramid_building_char
			character_event = { id = ancrel.4004 }
		}
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0
				NOT = {
					wealth = 1000
				}
			}
			modifier = {
				factor = 0
				NOT = {
					learning = 8
				}
			}
		}		
	}
	
	restore_priesthood_egyptian_pagan = {
		is_high_prio = yes
		ai_check_interval = 12
		icon_religion = egyptian_pagan
		only_playable = yes
		
		potential = {
			has_dlc = "The Old Gods"
			is_playable = yes
			higher_tier_than = duke
			OR = {
				religion = egyptian_pagan
				religion = aten_pagan
			}
			NOT = { has_global_flag = egyptian_priesthood_founded }
			has_regent = no		
		}
		allow = {
			realm_learning = 25
			tier = emperor
			piety = 500
			wealth = 500
			war = no
			religion_authority = 0.6	
			b_luxor = { 
				has_holder = yes 
				holder_scope = { top_liege = { character = ROOT } }
			}
		}
		effect = {
			set_global_flag = egyptian_priesthood_founded
			wealth = -500
			piety = -250
			prestige = 250
			activate_title = { title = d_egyptian_pagan status = yes }
			d_egyptian_pagan = {
				grant_title = ROOT
			}			
			hidden_tooltip = {
				narrative_event = { id = ancrel.4006 }
				if = {
					limit = { ROOT = { ai = no } }
					ROOT = {
						chronicle = {
							entry = CHRONICLE_EGYPTIAN_PRIESTHOOD
							portrait = [Root.GetID]
						}
					}
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}

	organize_anubis = {
		is_high_prio = yes
		only_playable = yes
		ai_check_interval = 12
		
		potential = {
			is_playable = yes
			higher_tier_than = duke
			has_regent = no
			OR = {
				religion = egyptian_pagan
				religion = aten_pagan
			}
			NOT = { has_global_flag = anubis_founded }
			NOT = { has_global_flag = horus_founded }
		}
		allow = {
			prestige = 300
			wealth = 300
		}
		effect = {
			set_global_flag = anubis_founded
			prestige = -300
			wealth = -300
			activate_title = { title = d_anubis status = yes }
			hidden_tooltip = {
				set_character_flag = event_ancrel.4007
				narrative_event = { id = ancrel.4007 }
				create_character = {
					random_traits = yes
					religion = egyptian_pagan
					culture = egyptian_arabic
					dynasty = NONE
					age = 34
					attributes = {
						martial = 7
						diplomacy = 5
						intrigue = 2
						learning = 2
						stewardship = 2
					}
				}
				new_character = {
					d_anubis = {
						grant_title = PREV
					}
					set_defacto_liege = ROOT
					if = {
						limit = { ROOT = { ai = no } }
						ROOT = {
							chronicle = {
								entry = CHRONICLE_ANUBIS_GUARD
								portrait = [Prev.GetID]
							}
						}
					}
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}

	organize_horus = {
		is_high_prio = yes
		only_playable = yes
		ai_check_interval = 12
		
		potential = {
			is_playable = yes
			higher_tier_than = king
			has_regent = no
			OR = {
				religion = egyptian_pagan
				religion = aten_pagan
			}
			NOT = { has_global_flag = horus_founded }
			has_global_flag = anubis_founded
		}
		allow = {
			prestige = 300
			wealth = 300
		}
		effect = {
			set_global_flag = horus_founded
			prestige = -300
			wealth = -300
			activate_title = { title = d_horus status = yes }
			hidden_tooltip = {
				set_character_flag = event_ancrel.4008
				narrative_event = { id = ancrel.4008 }
				create_character = {
					random_traits = yes
					religion = egyptian_pagan
					culture = egyptian_arabic
					dynasty = NONE
					age = 34
					attributes = {
						martial = 7
						diplomacy = 5
						intrigue = 2
						learning = 2
						stewardship = 2
					}
				}
				new_character = {
					d_horus = {
						grant_title = PREV
					}
					set_defacto_liege = ROOT
					if = {
						limit = { ROOT = { ai = no } }
						ROOT = {
							chronicle = {
								entry = CHRONICLE_HORUS_GUARD
								portrait = [Prev.GetID]
							}
						}
					}
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}	
}