decisions = {
	ask_for_hre = {
		only_playable = yes
		is_high_prio = yes
		potential = {
			religion = nicene
			age = 16
			prisoner = no
			NOT = { trait = incapable }
			demesne_size = 225
			tier = emperor
			NOT = { culture = roman }
			NOT = { has_landed_title = e_wre }
			NOT = { has_landed_title = e_roman_empire }
			NOT = { has_landed_title = e_axum }
			NOT = { has_landed_title = e_italy }
			NOT = { has_landed_title = e_byzantium }
			NOT = { has_character_flag = asked_for_hre }
			NOT = { has_global_flag = hre_formed }
		}
		allow = {
			scaled_wealth = 2.0
			is_heretic = no
		}
		effect = {
			set_character_flag = asked_for_hre
			hidden_tooltip = {
				d_papal_state = {
					holder_scope = {
						character_event = { id = spirit.3 days = 5 random = 12 tooltip = "hre_ask" }
					}
				}
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				NOT = {
					scaled_wealth = 10.0
				}
			}
			modifier = {
				factor = 2
				trait = zealous
			}
			modifier = {
				factor = 2
				trait = ambitious
			}
		}
	}
	
	ask_for_wre = {
		only_playable = yes
		is_high_prio = yes
		potential = {
			OR = {
				religion_group = christian
				religion_group = pagan_group
			}
			age = 16
			prisoner = no
			NOT = { trait = incapable }
			demesne_size = 225
			tier = king
			e_wre = {
				has_holder = no
			}
			e_byzantium = {
				has_holder = yes
			}
			NOT = { culture = roman }
			NOT = { has_landed_title = e_wre }
			NOT = { has_landed_title = e_roman_empire }
			NOT = { has_landed_title = e_byzantium }
			NOT = { has_character_flag = asked_for_wre }
			NOT = { has_global_flag = wre_reformed }
		}
		allow = {
			scaled_wealth = 2.0
		}
		effect = {
			set_character_flag = asked_for_wre
			hidden_tooltip = {
				e_byzantium = {
					holder_scope = {
						character_event = { id = spirit.3 days = 5 random = 12 tooltip = "wre_ask" }
					}
				}
			}
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				NOT = {
					scaled_wealth = 10.0
				}
			}
			modifier = {
				factor = 5
				trait = cynical
			}
			modifier = {
				factor = 5
				trait = ambitious
			}
		}
	}

	organize_scholae_palatinae = {
		only_playable = yes
		is_high_prio = yes
		potential = {
			OR = { 
				has_landed_title = e_byzantium
				has_landed_title = e_roman_empire
			}
			is_female = no
			prisoner = no
			age = 16
			NOT = { has_global_flag = scholae_palatinae_founded }
		}
		allow = {
			prestige = 300
			wealth = 300
		}
		effect = {
			set_global_flag = scholae_palatinae_founded
			prestige = -300
			wealth = -300
			activate_title = { title = d_scholae_palatinae status = yes }
			hidden_tooltip = {
				narrative_event = { id = guard.3100 }
				create_random_soldier = {
					random_traits = yes
					religion = nicene
					culture = greek
					dynasty = NONE
					female = no
					age = 34
					trait = skilled_tactician
				}
				new_character = {
					d_scholae_palatinae = {
						grant_title = PREV
					}
					set_defacto_liege = ROOT
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	reorganize_western_scholae_palatinae = {
		only_playable = yes
		is_high_prio = yes
		potential = {
			OR = { 
				has_landed_title = e_wre
				has_landed_title = e_roman_empire
			}
			is_female = no
			prisoner = no
			age = 16
			NOT = { has_global_flag = western_scholae_palatinae_reorganized }
			NOT = { is_title_active = d_praetorian_guard } #shouldn't coexist with them
		}
		allow = {
			prestige = 300
			wealth = 300
			realm_size = 100 # Prevents it from being done too easily
			NOT = { is_title_active = d_praetorian_guard } #shouldn't coexist with them
		}
		effect = {
			set_global_flag = western_scholae_palatinae_reorganized
			prestige = -300
			wealth = -300
			activate_title = { title = d_western_scholae_palatinae status = yes }
			hidden_tooltip = {
				narrative_event = { id = guard.31002 }
				create_random_soldier = {
					random_traits = yes
					religion = nicene
					culture = roman
					dynasty = NONE
					female = no
					age = 34
					trait = skilled_tactician
				}
				new_character = {
					d_western_scholae_palatinae = {
						grant_title = PREV
					}
					set_defacto_liege = ROOT
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	reorganize_praetorian_guard = {
		only_playable = yes
		is_high_prio = yes
		potential = {
			OR = { 
				has_landed_title = e_wre
				has_landed_title = e_roman_empire
			}
			is_female = no
			prisoner = no
			age = 16
			NOT = { has_global_flag = praetorian_guard_reorganized }
			NOT = { is_title_active = d_western_scholae_palatinae } #shouldn't coexist with them
		}
		allow = {
			prestige = 300
			wealth = 300
			realm_size = 100 # Prevents it from being done too easily
			NOT = { is_title_active = d_western_scholae_palatinae } #shouldn't coexist with them
		}
		effect = {
			set_global_flag = praetorian_guard_reorganized
			prestige = -300
			wealth = -300
			activate_title = { title = d_praetorian_guard status = yes }
			hidden_tooltip = {
				narrative_event = { id = guard.31003 }
				create_random_soldier = {
					random_traits = yes
					religion = nicene
					culture = roman
					dynasty = NONE
					female = no
					age = 34
					trait = skilled_tactician
				}
				new_character = {
					d_praetorian_guard = {
						grant_title = PREV
					}
					set_defacto_liege = ROOT
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	reform_imperial_fleet_wre = {
		is_high_prio = yes
		only_playable = yes
		potential = {
			prisoner = no
			age = 16
			OR = { 
				has_landed_title = e_wre
				has_landed_title = e_roman_empire
			}
			NOT = { is_title_active = d_imperial_fleet_wre }
		}
		allow = {
			wealth = 2000
			completely_controls = c_ravenna # Ravenna was an important port
			has_landed_title = c_ravenna
		}
		effect = {
			wealth = -2000
			activate_title = { title = d_imperial_fleet_wre status = yes }
			hidden_tooltip = {
				create_legion_commander_effect = yes
				new_character = {
					d_imperial_fleet_wre = {
						grant_title = PREV
						religion = PREV
					}
					set_defacto_liege = ROOT
					character_event = { id = LEG.1 }
				}
			}
		}
		
		ai_will_do = {
			factor = 1
		}
	}
	
	reform_imperial_fleet_ere = {
		is_high_prio = yes
		only_playable = yes
		potential = {
			prisoner = no
			age = 16
			OR = { 
				has_landed_title = e_byzantium
				has_landed_title = e_roman_empire
			}
			NOT = { is_title_active = d_imperial_fleet_ere }
		}
		allow = {
			wealth = 2000
			completely_controls = c_byzantion # Constantinople was the main port of the imperial navy
			has_landed_title = c_byzantion
		}
		effect = {
			wealth = -2000
			activate_title = { title = d_imperial_fleet_ere status = yes }
			hidden_tooltip = {
				create_legion_commander_effect = yes
				new_character = {
					d_imperial_fleet_ere = {
						grant_title = PREV
						religion = PREV
					}
					set_defacto_liege = ROOT
					character_event = { id = LEG.1 }
				}
			}
		}
		
		ai_will_do = {
			factor = 1
		}
	}

	# restore_italia = {
		# only_playable = yes
		# is_high_prio = yes
		# potential = {
			# always = no # TODO Event restoration.1 does not exist !
			# has_landed_title = k_italia
			# is_female = no
			# prisoner = no
			# age = 16
			# NOT = { has_global_flag = italia_restored }
		# }
		# allow = {
			# prestige = 3000
			# wealth = 3000
		# }
		# effect = {
			# set_global_flag = italia_restored 
			# prestige = 500
			# wealth = -3000
			# hidden_tooltip = {
				# character_event = { id = restoration.1 }
			# }
		# }
		# ai_will_do = {
			# factor = 1
		# }
	# }
	
	support_greens = {
		only_playable = yes
		potential = {
			has_romance_culture_trigger = yes
			has_global_flag = circus_maximus_built
			NOT = {
				OR = {
					trait = greens_supporter
					trait = blues_supporter
				}
			}
			is_ruler = yes
			age = 16
			prisoner = no
		}
		
		allow = {
			piety = 50
		}
		
		effect = {
			add_trait = greens_supporter
			character_event = { id = SENATE.600 tooltip = EVTTOOLTIP_SENATE_600 }
		}
		
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0
				trait = zealous
			}
			modifier = {
				factor = 1.2
				trait = cynical
			}
			modifier = {
				factor = 1.2
				liege = { trait = greens_supporter }
			}
			modifier = {
				factor = 0.005 # Slow it down
			}
		}
	}
	
	support_blues = {
		only_playable = yes
		potential = {
			has_romance_culture_trigger = yes
			has_global_flag = circus_maximus_built
			NOT = { 
				OR = {
					trait = greens_supporter
					trait = blues_supporter
				}
			}
			is_ruler = yes
			age = 16
			prisoner = no
		}
		
		allow = {
			piety = 50
		}
		
		effect = {
			add_trait = blues_supporter
			character_event = { id = SENATE.601 tooltip = EVTTOOLTIP_SENATE_601 }
		}
		
		ai_will_do = {
			factor = 1
			
			modifier = {
				factor = 0
				trait = cynical
			}
			modifier = {
				factor = 1.2
				trait = zealous
			}
			modifier = {
				factor = 1.2
				liege = { trait = blues_supporter }
			}
			modifier = {
				factor = 1.2
				decadence = 40
			}
			modifier = {
				factor = 1.2
				decadence = 60
			}
			modifier = {
				factor = 1.2
				decadence = 80
			}
			modifier = {
				factor = 0.005 # Slow it down
			}
		}
	}

	rebuild_circus_maximus = {
		only_playable = yes
		is_high_prio = yes
		potential = {
			OR = { 
				religion_group = christian
				religion_group = pagan_group
			}
			has_landed_title = c_roma
			prisoner = no
			age = 16
			NOT = { has_global_flag = circus_maximus_built }
			NOT = { has_global_flag = building_circus_maximus }
		}
		allow = {
			wealth = 1500
			prestige = 1000
		}
		effect = {
			hidden_tooltip = {
				character_event = { id = SENATE.100 }
			}
			set_global_flag = building_circus_maximus
			wealth = -1500
			prestige = 500
			piety = 500
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	build_hagia_sophia = {
		only_independent = yes
		is_high_prio = yes
		potential = {
			religion_group = christian
			has_landed_title = c_byzantion
			has_romance_culture_trigger = yes # Particular architecture
			OR = { # Symbol of power
				has_landed_title = e_byzantium
				has_landed_title = e_roman_empire
				AND = {
					capital_scope = {
						province = 496 # Constantinople
					}
					higher_tier_than = duke
				}
			}
			prisoner = no
			age = 16
			NOT = { has_global_flag = hagia_sophia_built }
			NOT = { has_global_flag = building_hagia_sophia }
		}
		allow = {
			wealth = 2500
			prestige = 1000
		}
		effect = {
			hidden_tooltip = {
				character_event = { id = imperial_legacy.40 }
			}
			set_global_flag = building_hagia_sophia
			wealth = -2500
			prestige = 500
			piety = 500
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.5 # Decrease the chance that the AI will do this unless they hold an empire
				NOT = { tier = emperor }
			}
		}
	}
	
	organize_excubitors = {
		only_playable = yes
		is_high_prio = yes
		potential = {
			OR = {
				has_landed_title = e_byzantium
				has_landed_title = e_roman_empire
			}
			is_female = no
			prisoner = no
			age = 16
			NOT = { has_global_flag = excubitors_founded }
		}
		allow = {
			prestige = 300
			wealth = 300
		}
		effect = {
			set_global_flag = excubitors_founded
			prestige = -300
			wealth = -300
			activate_title = { title = d_excubitors status = yes }
			hidden_tooltip = {
				narrative_event = { id = guard.31001 }
				create_random_soldier = {
					random_traits = yes
					religion = nicene
					culture = greek
					dynasty = NONE
					female = no
					age = 34
					trait = skilled_tactician
				}
				new_character = {
					d_excubitors = {
						grant_title = PREV
					}
					set_defacto_liege = ROOT
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	abolish_masmuda = {
		only_playable = yes
		potential = {
			has_landed_title = k_masmuda
			age = 16
			prisoner = no
			demesne_size = 1
			NOT = { has_character_flag = abolished_confederacy }
		}
		allow = {
			prestige = 1500
		}
		effect = {
			prestige = -1500
			any_vassal = { add_claim = k_masmuda }
			primary_title = {
				k_masmuda = {
					add_law = succ_seniority
				}
			}
		}
		ai_will_do = {
			factor = 0 # On average ca 1 year before taken
			modifier = {
				factor = 2.0
				trait = ambitious
			}
			modifier = {
				factor = 1.0
				trait = cruel
			}
		}
	}
	
	sole_roman_empire = {
		only_independent = yes
		is_high_prio = yes
		potential = {
			OR = {
				has_landed_title = e_wre
				has_landed_title = e_byzantium
			}
			OR = {
				religion_group = christian
				religion_group = pagan_group
			}
			age = 16
			prisoner = no
			NOT = { trait = incapable }
			NOT = { has_claim = e_roman_empire }
			has_romance_culture_trigger = yes
			NOT = { has_global_flag = sole_roman_empire }
		}
		allow = {
			prestige = 1500
			wealth = 300
			OR = {
				e_wre = { has_holder = no}
				e_byzantium = { has_holder = no}
				NOT = {
					is_title_active = e_byzantium
				}
				NOT = {
					is_title_active = e_wre
				}
			}
		}
		effect = {
			wealth = -300
			add_weak_pressed_claim = e_roman_empire
			hidden_tooltip = {
				narrative_event = { id = imperial_legacy.10 }
			}
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	unite_roman_empires = {
		only_independent = yes
		is_high_prio = yes
		potential = {
			has_dlc = "Legacy of Rome"
			e_wre = { has_holder = yes }
			e_byzantium = { has_holder = yes }
			OR = {
				has_landed_title = e_wre
				has_landed_title = e_byzantium
			}
			OR = {
				religion_group = christian
				religion_group = pagan_group
			}
			age = 16
			prisoner = no
			NOT = { trait = incapable }
			NOT = { has_global_flag = rome_restored }
			has_romance_culture_trigger = yes
		}
		allow = {
			prestige = 3000
			has_landed_title = e_wre
			has_landed_title = e_byzantium
		}
		effect = {
			set_global_flag = rome_restored
			narrative_event = { id = LoR.20 tooltip = EVTTOOLTIPLoR.20 }
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	adopt_bureaucratic_government = {
		only_independent = yes
		is_high_prio = yes
		potential = {
			higher_tier_than = king
			OR = {
				has_landed_title = e_wre
				has_landed_title = e_byzantium
				has_landed_title = e_roman_empire
				has_romance_culture_trigger = yes
			}
			age = 16
			prisoner = no
			NOT = { trait = incapable }
			NOT = { government = bureaucratic_government }
			NOT = { government = tribal_government }
			NOT = { government = nomadic_government }
			primary_title = {
				NOT = { has_title_flag = adopted_bureaucratic }
			}
			government = sub_roman_government # Only the Sub-Roman rulers maintain sufficient taxation
		}
		allow = {
			OR = { # Administration laws indicate being an empire
				primary_title = { has_law = imperial_administration }
				primary_title = { has_law = ze_administration_laws_2 }
			}
			prestige = 750
			wealth = 200
		}
		effect = {
			prestige = -750
			wealth = -200
			narrative_event = { id = imperial_legacy.39 }
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.5 # Decrease chance AI will do this unless they hold one of the Roman empires
				NOR = {
					has_landed_title = e_wre
					has_landed_title = e_byzantium
					has_landed_title = e_roman_empire
				}
			}
			modifier = {
				factor = 0.5 # Decrease chance AI will do this unless they are of the Romance group
				has_romance_culture_trigger = no
			}
		}
	}
	
	convert_to_high_tribal_indep  = {
		only_independent = yes
		is_high_prio = yes
		
		potential = {
			is_playable = yes
			is_tribal = yes
			independent = yes
		}
		allow = {
			war = no
			custom_tooltip = {
				text = TT_NOT_UNREFORMED_PAGAN
				hidden_tooltip = {
					OR = {
						NOT = { religion_group = pagan_group }
						is_reformed_religion = yes
						religion = bon
					}
				}
			}
			primary_title = { has_law = tribal_organization_4 }
			capital_holding = {
				OR = {
					AND = {
						holding_type = tribal
						has_building = tb_hillfort_4
					}
					holding_type = castle
				}
			}
		}
		
		effect = {
			if = {
				limit = { ai = no }
				set_character_flag = achievement_not_a_tribe
			}
	
			set_government_type = high_tribal_government
			primary_title = {
				set_title_flag = high_tribal_government_flag
			}
			
			hidden_tooltip = {
				any_demesne_title = {
					limit = {
						tier = baron
						holding_type = tribal
					}
					convert_to = CASTLE
					refill_holding_levy = yes
					
					if = {
						limit = {
							dejure_liege_title = {
								holder = ROOT
								location = {
									num_of_empty_holdings = 2
								}
								NOT = {
									any_direct_de_jure_vassal_title = {
										holding_type = city
									}
								}
							}
						}
						location = {
							build_holding = {
								type = city
							}
						}
					}
					if = {
						limit = {
							dejure_liege_title = {
								holder = ROOT
								location = {
									num_of_empty_holdings = 2
								}
								NOT = {
									any_direct_de_jure_vassal_title = {
										holding_type = temple
									}
								}
							}
						}
						location = {
							build_holding  ={
								type = temple
							}
						}
					}
				}
			}
		}
		
		ai_will_do = {
			factor = 1
		}
	}
	
	convert_to_high_tribal_vassal = {
		only_rulers = yes
		is_high_prio = yes
		
		potential = {
			is_ruler = yes
			is_tribal = yes
			independent = no
		}
		allow = {
			war = no
			custom_tooltip = {
				text = TT_NOT_UNREFORMED_PAGAN
				hidden_tooltip = {
					OR = {
						NOT = { religion_group = pagan_group }
						is_reformed_religion = yes
						religion = bon
					}
				}
			}
			liege = {
				OR = {
					is_feudal = yes
					is_republic = yes
					AND = {
						is_theocracy = yes
						custom_tooltip = {
							text = TT_NOT_UNREFORMED_PAGAN
							hidden_tooltip = {
								OR = {
									NOT = { religion_group = pagan_group }
									is_reformed_religion = yes
									religion = bon
								}
							}
						}
					}
				}
			}
			OR = {
				capital_holding = {
					OR = {
						AND = {
							holding_type = tribal
							has_building = tb_hillfort_4
						}
						holding_type = castle
					}
				}
				AND = {
					NOT = { tier = BARON }
					capital_scope = {
						any_province_holding = {
							holding_type = castle
							holder_scope = {
								OR = {
									character = ROOT
									is_liege_or_above = ROOT
								}
							}
						}
					}
				}
			}
		}
		
		effect = {
			set_character_flag = achievement_not_a_tribe
			
			set_government_type = high_tribal_government
			primary_title = {
				set_title_flag = high_tribal_government_flag
			}
						
			hidden_tooltip = {
				if = {
					limit = {
						capital_holding = {
							holding_type = tribal
							ROOT = { NOT = { tier = BARON } }
						}
						capital_scope = {
							any_province_holding = {
								holding_type = castle
								holder_scope = {
									OR = {
										character = ROOT
										is_liege_or_above = ROOT
									}
								}
							}
						}
					}
					
					capital_scope = {
						random_province_holding = {
							limit = {
								holding_type = castle
								holder_scope = {
									OR = {
										character = ROOT
										is_liege_or_above = ROOT
									}
								}
							}
							if = {
								limit = {
									NOT = { holder = ROOT }
								}
								usurp_title = ROOT
							}
							make_capital_holding = yes
							ROOT = { set_character_flag = feudalize_handled_capital }
						}
					}
				}
				
				any_demesne_title = {
					limit = {
						tier = baron
						holding_type = tribal
						location = {
							capital_holding = {
								NOT = { holding_type = castle }
							}
						}
					}
					convert_to = CASTLE
					refill_holding_levy = yes
					
					if = {
						limit = {
							dejure_liege_title = {
								holder = ROOT
								location = {
									num_of_empty_holdings = 2
								}
								NOT = {
									any_direct_de_jure_vassal_title = {
										holding_type = city
									}
								}
							}
						}
						location = {
							build_holding = {
								type = city
							}
						}
					}
					if = {
						limit = {
							dejure_liege_title = {
								holder = ROOT
								location = {
									num_of_empty_holdings = 2
								}
								NOT = {
									any_direct_de_jure_vassal_title = {
										holding_type = temple
									}
								}
							}
						}
						location = {
							build_holding = {
								type = temple
							}
						}
					}
				}
				
				liege = {
					character_event = { id = 55100 } # Notify Liege
				}
			}
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.001
				liege = {
					OR = {
						NOT = { religion_group = ROOT }
						AND = {
							religion_group = pagan_group
							NOT = { religion = ROOT }
						}
					}
				}
			}
			modifier = {
				factor = 0.01
				liege = {
					NOT = { culture_group = ROOT }
				}
			}
			
			modifier = {
				factor = 0.01
				liege = {
					religion_group = ROOT
					NOT = { religion_group = pagan_group }
					NOT = { religion = ROOT }
				}
			}
			modifier = {
				factor = 0.1
				liege = {
					culture_group = ROOT
					NOT = { culture = ROOT }
				}
			}
		}
	}	
	
	restore_western_roman_empire = {
		only_independent = yes
		is_high_prio = yes
		potential = {
			NOT = { has_landed_title = e_byzantium } # Use restore_roman_empire instead
			e_wre = {
				has_holder = no
			}
			e_roman_empire = {
				has_holder = no
			}
			OR = {
				religion_group = christian
				religion_group = pagan_group
			}
			age = 16
			prisoner = no
			NOT = { trait = incapable }
			has_romance_culture_trigger = yes
		}
		allow = {
			# Controls Italia and Roma
			completely_controls_region = custom_diocese_italia_annonaria
			completely_controls_region = custom_diocese_italia_suburbicaria
			completely_controls_region = custom_diocese_raetia_noricum
			capital_scope = {
				OR = {
					province = 333 # Roma
					province = 235 # Mediolanum
					province = 351 # Ravenna
					province = 118 # Augusta Treverorum
				}
			}
			
			# Rome's glory
			custom_tooltip = {
				hidden_tooltip = {
					has_global_flag = circus_maximus_built
				}
				text = restore_western_roman_empire.tooltip
			}
#			is_title_active = c_legio_i_suburbicaria
			is_title_active = c_legio_viii_augusta
			has_global_flag = circus_maximus_built
			
			# Prestige and power
			prestige = 1500
			num_of_king_titles = 3
		}
		effect = {
			hidden_tooltip = {
				narrative_event = { id = imperial_legacy.11 }
			}
		}
		ai_will_do = {
			factor = 1
		}
	}

	restore_eastern_roman_empire = {
		only_independent = yes
		is_high_prio = yes
		potential = {
			NOT = { has_landed_title = e_wre } # Use restore_roman_empire instead
			e_byzantium = {
				has_holder = no
			}
			e_roman_empire = {
				has_holder = no
			}
			OR = {
				religion_group = christian
				religion_group = pagan_group
			}
			age = 16
			prisoner = no
			NOT = { trait = incapable }
			has_romance_culture_trigger = yes
		}
		allow = {
			# Controls Greece, Anatolia and Constantinople
			completely_controls_region = custom_diocese_thrace
			completely_controls_region = custom_diocese_asiana
			capital_scope = {
				province = 496 # Constantinople
			}
			
			# Rome's glory
			is_title_active = c_legio_i_flavia_constantia
			is_title_active = c_legio_i_isaura_sagittaria
			is_title_active = c_legio_ii_herculia
			is_title_active = c_legio_ii_isaura
			is_title_active = c_legio_i_flavia_theodosiana
			is_title_active = c_legio_i_iovia
			
			# Prestige and power
			prestige = 1500
			num_of_king_titles = 3
		}
		effect = {
			hidden_tooltip = {
				narrative_event = { id = imperial_legacy.25 }
			}
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	reform_roman_senate = {
		only_playable = yes
		is_high_prio = yes
		potential = {
			has_romance_culture_trigger = yes
			NOT = { is_title_active = d_senate }
			OR = {
				religion_group = christian
				religion_group = pagan_group
			}
			OR = {
				has_landed_title = e_byzantium
				has_landed_title = e_wre
				has_landed_title = e_roman_empire
			}
			age = 16
			prisoner = no
			NOT = { trait = incapable }
		}
		allow = {
			# Controls Rome
			OR = {
				has_landed_title = c_roma
				any_realm_lord = {
					has_landed_title = c_roma
				}
			}
			
			# Rome's glory
			custom_tooltip = {
				hidden_tooltip = {
					has_global_flag = circus_maximus_built
				}
				text = restore_western_roman_empire
			}
			
			# Ostia, the holding of the Senate, is active
			is_title_active = b_ostia
			
			# Prestige
			prestige = 1500
		}
		effect = {
			activate_title = { title = d_senate status = yes }
			hidden_tooltip = {
				narrative_event = { id = SENATE.10005 }
				create_random_diplomat = {
					random_traits = yes
					religion = ROOT
					culture = roman
					dynasty = culture
					female = no
					age = 34
				}
				new_character = {
					b_ostia = {
						grant_title = PREV
					}
					d_senate = {
						grant_title = PREV
					}
					set_defacto_liege = ROOT
				}
			}
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	peregrinatio = {
		only_rulers = yes
		potential = {
			prisoner = no
			OR = {
				religion = insular
				religion = pelagianism
			}
		}
		allow = {
			war = no
			any_demesne_title = {
				NOT = { higher_tier_than = count }
				is_occupied = no
			}
			prisoner = no
		}
		effect = {
			custom_tooltip = {
				text = gaelic_abdication
				piety = 1500
				abdicate = yes
				add_trait = monk
				add_trait = wandering_hermit
				current_heir = {
					inherit = ROOT
					character_event = { id = ins.2 }
				}
			}
		}
		
		ai_will_do = {
			factor = 0
			
			modifier = {
				factor = 0
				NOT = {
					scaled_wealth = 3.0
				}
			}
			modifier = {
				factor = 0
				trait = cynical
			}
			modifier = {
				factor = 0
				trait = craven
			}
			modifier = {
				factor = 0
				trait = paranoid
			}
		}
	}
	
	call_synod_of_whitby = {
		only_rulers = yes
		is_high_prio = yes
	
		potential = {
			year = 644
			NOT = { has_global_flag = synod_of_whitby }
			prisoner = no
			OR = {
				religion = insular
				religion = nicene
			}
		}
		allow = {
			piety = 1000
			and = {
				owns = 57 # York
				any_realm_lord = {
					owns = 57
				}
			}
		}
		
		effect = {
			set_global_flag = synod_of_whitby
			narrative_event = { id = ins.4 days = 2 }
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				trait = cynical
			}
			modifier = {
				factor = 0
				trait = arbitrary
			}
			modifier = {
				factor = 0
				AND = {
					culture_group = celtic
					trait = zealous
				}
			}
		}
	}
	
	lex_burgundionum = {
		only_independent = yes
		
		is_high_prio = yes
		
		potential = {
			has_landed_title = k_maxima_sequanorum
			religion = arian
			culture = burgundian
			NOT = { has_global_flag = lex_burgundionum }
			age = 16
			prisoner = no
			NOT = { trait = incapable }
		}
		
		allow = {
			prestige = 100
			NOT = { is_inaccessible_trigger = yes }
		}
		
		effect = {
			narrative_event = { id = hist.14 }
			set_global_flag = lex_burgundionum
			religion_authority = {
				modifier = lex_burgundionum
				years = 100
			}
		}
		
		ai_will_do = {
			factor = 1
		}
	}
	
	lex_visigothorum = {
		only_independent = yes
		
		is_high_prio = yes
		
		potential = {
			has_landed_title = k_visigoths
			religion = nicene # Share the same faith as Roman population
			culture = visigothic
			NOT = { has_global_flag = lex_visigothorum }
			age = 16
			prisoner = no
			NOT = { trait = incapable }
		}
		
		allow = {
			prestige = 100
			NOT = { is_inaccessible_trigger = yes }
		}
		
		effect = {
			narrative_event = { id = hist.25 }
			set_global_flag = lex_visigothorum
			religion_authority = {
				modifier = lex_visigothorum
				years = 100
			}
		}
		
		ai_will_do = {
			factor = 1
		}
	}
	
	twothousandth_anniversary_gothic_kingdom = { # Proclaim 2000th anniversary of the Gothic kingdom (based upon Cassiodorus)
		only_independent = yes
		
		is_high_prio = yes
		
		potential = {
			OR = {
				has_landed_title = k_ostrogoths
				tier = EMPEROR
			}
			OR = {
				culture = romano_gothic
				culture = ostrogothic
			}
			age = 16
			prisoner = no
			NOT = { trait = incapable }
			NOT = { has_global_flag = twothousandth_anniversary_gothic_kingdom }
		}
		allow = {
			prestige = 1000 # Power & sucess
			realm_size = 100 # Large realm
			wealth = 100 # It costs money to forge history
		}
		effect = {
			wealth = -100
			narrative_event = { id = hist.17 }
			set_global_flag = twothousandth_anniversary_gothic_kingdom
		}
		
		ai_will_do = {
			factor = 1
		}
	}

	assign_poet = { # For the AI, because they are dumb enough not to hand out minor titles
		only_playable = yes
		
		potential = {
			ai = yes
			OR = {
				culture_group = celtic
				culture = romano_british
				religion = insular
				religion = celtic_pagan
				religion = celtic_pagan_reformed
			}
			NOT = {
				any_courtier = {
					has_minor_title = title_court_celtic_poet
				}
			}
		}
		allow = {
			primary_title = { higher_tier_than = BARON }
			any_courtier = {
				trait = poet
				is_female = no
				is_adult = yes
			}
		}
		effect = {
			random_courtier = {
				limit = {
					is_adult = yes
					is_female = no
					trait = poet
				}
				give_minor_title = title_court_celtic_poet
			}
			
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.75 #Decrease chance AI will do this - they'll still do it eventually anyways, this will just prevent them from doing it immediately
			}
		}
	}

	#CHRISTIAN
	patrons_ins = {
		only_playable = yes
		potential = {
			is_playable = yes
			is_landed = yes
			age = 16
			NOT = {
				trait = incapable
				trait = infirm
				trait = possessed
			}
			NOT = {
				has_character_modifier = patron_peter
				has_character_modifier = patron_george
				has_character_modifier = patron_ambrose
				has_character_modifier = patron_gregory
				has_character_modifier = patron_augustine
				has_character_modifier = patron_anthony
				has_character_modifier = patron_mary
				has_character_modifier = patron_thomas
				has_character_modifier = patron_john
			}
			religion = insular
		}
		allow = {
			prisoner = no
		}
		effect = {
			character_event = { id = PATRONS_CHR.1 }
		}
		
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0.05
			}
			modifier = {
				factor = 0.2
				trait = slothful
			}
			modifier = {
				factor = 0.1
				trait = cynical
			}
			modifier = {
				factor = 1.1
				age = 40
			}
			modifier = {
				factor = 1.3
				age = 50
			}
			modifier = {
				factor = 1.5
				age = 60
			}
		}
	}
	
	divide_roman_empire = {
		only_independent = yes
		is_high_prio = yes
		potential = {
			has_landed_title = e_roman_empire
			age = 16
			realm_size = 200
		}
		allow = {
			scaled_wealth = 1.0
			prisoner = no
			war = no
			NOT = { trait = incapable }
			any_dynasty_member = { is_heir = yes }
			completely_controls = c_byzantion
			completely_controls = c_roma
			completely_controls = c_ravenna
		}
		effect = {
			custom_tooltip = {
				text = divide_roman_empire_tooltip
				narrative_event = { id = imperial_legacy.50 }
			}
		}
		ai_will_do = {
			factor = 0.0001
			modifier = {
				factor = 100
				trait = lunatic
			}
			modifier = {
				factor = 2
				over_vassal_limit = 1
			}
			modifier = {
				factor = 3
				over_vassal_limit = 5
			}
			modifier = {
				factor = 4
				over_vassal_limit = 10
			}
			modifier = {
				factor = 0
				trait = ambitious
			}
			modifier = {
				factor = 0
				war = yes
			}
		}
	}
	
	adopt_greek_official_language = {
		only_independent = yes
		is_high_prio = yes # Will show an alert once decision is enabled
		potential = {
			has_landed_title = e_byzantium
			primary_title = {
				title = e_byzantium
			}
			e_byzantium = {
				has_title_flag = themata_system # After loss of Oriens and Aegypt
			}
			capital_scope = {
				culture	= greek # Greek present in capital
			}
			age = 16
			prisoner = no
			NOT = { trait = incapable }
			has_romance_culture_trigger = yes
			NOT = { culture = roman }
		}
		allow = {
			prestige = 500
		}
		effect = {
			custom_tooltip = {
				text = adopt_greek_official_language.tooltip
			}
			prestige = -500
			capital_scope = {
				add_province_modifier = { name = greek_official_language duration = -1 }
			}
		}
		ai_will_do = {
			factor = 1
		}
	}
	
	close_platonic_academy = {
		only_independent = yes
		is_high_prio = yes # Will show an alert once decision is enabled
		
		potential = {
			religion_group = christian
			war = no
			age = 16
			prisoner = no
			NOT = { trait = incapable }
			is_title_active = d_platonic_academy
			NOT = { has_global_flag = closed_platonic_academy }
			higher_tier_than = king
			OR = {
				d_platonic_academy = {
					holder_scope = {
						is_liege_or_above = ROOT
					}
				}
				completely_controls = k_achaia
				AND = { 
					has_landed_title = k_achaia
					has_landed_title = c_atheniai
				}
				any_vassal = {
					AND = { 
						has_landed_title = k_achaia
						has_landed_title = c_atheniai
					}
				}
			}
		}
		
		allow = {
			d_platonic_academy = {
				has_holder = yes
			}
			prestige = 200
		}
		
		effect = {
			activate_title = { title = d_platonic_academy status = no }
			piety = 100
			prestige = -100
			narrative_event = { id = hist.27 }
			set_global_flag = closed_platonic_academy
			save_event_target_as = target_academy_closer_title #for localisation
		}
		
		ai_will_do = {
			factor = 0.01
			modifier = {
				factor = 10
				trait = zealous
			}
			modifier = {
				factor = 0.1
				trait = sympathy_pagans
			}
			modifier = {
				factor = 0.1
				trait = scholar
			}
			modifier = {
				factor = 0.001 # Slow it down
				always = yes
			}
		}
	}
	hold_a_chariot_race = {
		only_independent = yes
		is_high_prio = yes
		
		potential = {
			is_playable = yes
			has_romance_culture_trigger = yes
			has_dlc = "Legacy of Rome"
			independent = yes
			NOT = { is_nomadic = yes }
			OR = {
				gender_equality_trigger = yes
				NOT = { is_female = yes	}
			}
			OR = {
				tier = king
				tier = emperor
			}
			location = {
				owner = { character = ROOT }
			}
			NOT = { has_character_modifier = held_a_chariot_race }
		}
		allow = {
			war = no
			prisoner = no
			in_command = no
			NOT = { is_inaccessible_trigger = yes }
			age = 16
			prestige = 500
			wealth = 200
			custom_tooltip = {
				text = is_not_busy_trigger_tooltip
				hidden_tooltip = { NOT = { has_character_flag = do_not_disturb } }
			}
		}
		effect = {
			add_character_modifier = {
				name = held_a_chariot_race
				duration = 365
			}
			set_character_flag = do_not_disturb
			wealth = -200
			prestige = 100
			character_event = { id = WtWSMS_flavour.52 } # Chariot race
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				NOT = {
					OR = {
						wealth = 1000
						scaled_wealth = 3.0
					}
				}
			}
		}
	}
	forge_iron_crown_of_lombardy = {
		only_independent = yes
		is_high_prio = yes
		
		potential = {
			is_playable = yes
			culture = lombard
			has_dlc = "Mystics"
			independent = yes
			start_date < 570.1.1
			NOT = { has_global_flag = iron_crown_of_lombardy_forged } #no need to set this flag in history
		}
		allow = {
			has_landed_title = k_lombardia
			war = no
			prisoner = no
			age = 16
			prestige = 500
			wealth = 500
		}
		effect = {
			wealth = -500
			prestige = 200
			add_artifact = iron_crown_of_lombardy
			set_global_flag = iron_crown_of_lombardy_forged
		}
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 0
				NOT = {
					OR = {
						wealth = 1000
						scaled_wealth = 3.0
					}
				}
			}
		}
	}
}
