namespace = purple_phoenix 

normal_or_historical_nations = yes

country_event = {

	id = purple_phoenix.1
	
	is_triggered_only = yes
	
	picture = CIVIL_WAR_eventPicture
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		num_of_cities = 8
		government = monarchy
		NOT = { has_reform = steppe_horde }
		OR = {
			NOT = { legitimacy = 50 }
			has_regency = yes
		}
		has_government_attribute = civil_war_on_every_new_ruler
		always = no #BR Disabled: There's already other events that can fire
	}
		
	title = "purple_phoenix.1.t"
	desc = "purple_phoenix.1.d"
		
	option = {
		name = "purple_phoenix.1.a"
		trigger = {
			NOT = { legitimacy = 50 }
		}
		random_owned_province = {
			pretender_rebels = 2
		}
	}
	option = { #I noticed that if this event triggers because Byzantium has a regency, but still has high enough legitimacy, this event breaks.
		name = "purple_phoenix.1.a"
		trigger = {
			has_consort_regency = no
			has_regency = yes
		}
		if = { #If country has general
			limit = {
				if = {
					limit = {
						NOT = {
							is_heir_leader = yes
							is_monarch_leader = yes
						}
					}
					num_of_generals = 1
					NOT = { num_of_generals = 2 }
				}
				if = {
					limit = {
						is_heir_leader = yes
						NOT = { is_monarch_leader = yes }
					}
					num_of_generals = 2
					NOT = { num_of_generals = 3 }
				}
				if = {
					limit = {
						is_monarch_leader = yes
						NOT = { is_heir_leader = yes }
					}
					num_of_generals = 2
					NOT = { num_of_generals = 3 }
				}
				if = {
					limit = {
						is_heir_leader = yes
						is_monarch_leader = yes
					}
					num_of_generals = 3
					NOT = { num_of_generals = 4 }
				}
			}
			define_leader_to_ruler = {
				type = general
				adm = 1
				dip = 1
				mil = 3
				claim = 50
			}
		}
		else = {
			define_ruler = {
				adm = 1
				dip = 1
				mil = 3
				claim = 50
			}
		}
		
	}
}
 
country_event = {
	id = purple_phoenix.2
	
	title = "purple_phoenix.2.t"
	desc = "purple_phoenix.2.d"
	
	picture = ATHENS_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		religion = orthodox
		owns = 146 #Athens
	}
	
	mean_time_to_happen = {
		days = 7
	}
	
	option = {
		name = "purple_phoenix.2.a"
		add_prestige = 10
		add_legitimacy = 10
	}
}

country_event = {
	id = purple_phoenix.3
	
	title = "purple_phoenix.3.t"
	desc = "purple_phoenix.3.d"
	
	fire_only_once = yes
	
	picture = SIEGE_eventPicture
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		religion = orthodox
		owns = 316 #Izmit
	}
	
	mean_time_to_happen = {
		days = 7
	}
	
	option = {
		name = "purple_phoenix.3.a"
		add_prestige = 10
		add_legitimacy = 10
	}
}

country_event = {
	id = purple_phoenix.4
	
	title = "purple_phoenix.4.t"
	desc = "purple_phoenix.4.d"
	
	picture = SIEGE_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		religion = orthodox
		owns = 2313 #Antioch
	}
	
	mean_time_to_happen = {
		days = 7
	}
	
	option = {
		name = "purple_phoenix.4.a"
		add_patriarch_authority = 0.2
		add_legitimacy = 10
		add_country_modifier = {
			name = "byz_patriarch_blessing"
			duration = 7300
		}
	}
}

country_event = {
	id = purple_phoenix.5
	
	title = "purple_phoenix.5.t"
	desc = "purple_phoenix.5.d"
	
	picture = JERUSALEM_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		religion = orthodox
		owns = 379 #Judea
	}
	
	mean_time_to_happen = {
		days = 7
	}
	
	option = {
		name = "purple_phoenix.5.a"
		add_patriarch_authority = 0.2
		add_legitimacy = 10
		add_country_modifier = {
			name = "byz_patriarch_blessing"
			duration = 7300
		}
	}
}

country_event = {
	id = purple_phoenix.6
	
	title = "purple_phoenix.6.t"
	desc = "purple_phoenix.6.d"
	
	picture = ST_PETERS_CHURCH_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		religion = orthodox
		owns = 118 #Rome
	}
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = "purple_phoenix.6.a"
		add_prestige = 25
		add_legitimacy = 10
	}
}

country_event = {
	id = purple_phoenix.7
	
	title = "purple_phoenix.7.t"
	desc = "purple_phoenix.7.d"
	
	picture = ORTHODOX_eventPicture
	
	is_triggered_only = yes
	
	trigger = {
		always = no
		tag = BYZ
		has_dlc = "Purple Phoenix"
		religion = orthodox
		owns = 118 #Rome
		118 = { religion = orthodox }
	}
	
	option = {
		name = "purple_phoenix.7.a"
		add_patriarch_authority = 0.2
		add_country_modifier = {
			name = "byz_patriarch_blessing"
			duration = 7300
		}
	}
}

country_event = {
	id = purple_phoenix.8
	
	title = "purple_phoenix.8.t"
	desc = "purple_phoenix.8.d"
	
	picture = BATTLE_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		OR = {
			owns = 144
			owns = 147
			owns = 148
		}
		serbia_area = { type = all NOT = { owned_by = TUR }}
		rascia_area = { type = all NOT = { owned_by = TUR }}
		bosnia_area = { type = all NOT = { owned_by = TUR }}
		croatia_area = { type = all NOT = { owned_by = TUR }}
		albania_area = { type = all NOT = { owned_by = TUR }}
		east_adriatic_coast_area = { type = all NOT = { owned_by = TUR }}
	}
	
	mean_time_to_happen = {
		days = 7
	}
	
	option = {
		name = "purple_phoenix.8.a"
		add_prestige = 20
		add_legitimacy = 10
		add_army_tradition = 10
		#I seriously do not like the huge amount of extra points these events give.
		#add_mil_power = 50
		#add_dip_power = 50
		#add_adm_power = 50
	}
}

country_event = {
	id = purple_phoenix.9
	title = "purple_phoenix.9.t"
	desc = "purple_phoenix.9.d"
	picture = BATTLE_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		OR = {
			owns = 149
			owns = 4704
			owns = 1764
		}
		northern_macedonia_area = { type = all NOT = { owned_by = TUR }}
		bulgaria_area = { type = all NOT = { owned_by = TUR }}
		upper_thrace_area = { type = all NOT = { owned_by = TUR }}
		wallachia_area = { type = all NOT = { owned_by = TUR }}
		silistria_area = { type = all NOT = { owned_by = TUR }}
		
		macedonia_area = { type = all NOT = { owned_by = TUR }}
		thrace_area = { type = all NOT = { owned_by = TUR }}
		morea_area = { type = all NOT = { owned_by = TUR }}
		western_aegean_area = { type = all NOT = { owned_by = TUR }}
		northern_greece_area = { type = all NOT = { owned_by = TUR }}
		
		eastern_mediterrenean_islands_area = { type = all NOT = { owned_by = TUR }}
		aegean_archipelago_area = { type = all NOT = { owned_by = TUR }}
	}
	
	mean_time_to_happen = {
		days = 7
	}
	
	option = {
		name = "purple_phoenix.9.a"
		add_prestige = 20
		add_legitimacy = 10
		add_army_tradition = 10
	}
}

country_event = {
	id = purple_phoenix.10
	
	title = "purple_phoenix.10.t"
	desc = "purple_phoenix.10.d"
	
	picture = BATTLE_eventPicture
	
	fire_only_once = yes
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		OR = {
			owns = 316
			owns = 326
			owns = 329
		}
		anatolia_region = { type = all NOT = { owned_by = TUR }}
	}
	
	mean_time_to_happen = {
		days = 7
	}
	
	option = {
		name = "purple_phoenix.10.a"
		add_prestige = 35
		add_legitimacy = 10
		add_army_tradition = 10
	}
}
#TODO: Likely split events into 12 of them, each interacting with one of the logothetes.
country_event = {
	id = purple_phoenix.11
	
	title = "purple_phoenix.11.t"
	desc = "purple_phoenix.11.d"
	
	picture = BYZANTINE_EAGLE_eventPicture
		
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		has_government_mechanic = byzantine_bureaucracy_mechanic
		OR = {
			NOT = { has_country_flag = recent_BYZ_factions }
			had_country_flag = { flag = recent_BYZ_factions days = 365 }
		}
	}
	
	immediate = { set_country_flag = recent_BYZ_factions }
	
	mean_time_to_happen = {
		months = 36	
	}
	
	option = {
		name = "purple_phoenix.11.a"
		add_government_power = { 
			mechanic_type = byzantine_bureaucracy_mechanic  
			power_type = logothete_military_power
			value = 5
		}	
		add_government_power = { 
			mechanic_type = byzantine_bureaucracy_mechanic  
			power_type = logothete_waters_power
			value = 5
		}	
	}
}

country_event = {
	id = purple_phoenix.12
	
	title = "purple_phoenix.12.t"
	desc = "purple_phoenix.12.d"
	
	picture = BYZANTINE_EAGLE_eventPicture
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		has_government_mechanic = byzantine_bureaucracy_mechanic
		OR = {
			NOT = { has_country_flag = recent_BYZ_factions }
			had_country_flag = { flag = recent_BYZ_factions days = 365 }
		}
	}
	
	immediate = { set_country_flag = recent_BYZ_factions }
	
	mean_time_to_happen = {
		months = 72	
	}
	
	option = {
		name = "purple_phoenix.12.a"
		add_government_power = { 
			mechanic_type = byzantine_bureaucracy_mechanic  
			power_type = logothete_military_power
			value = -5
		}	
		add_government_power = { 
			mechanic_type = byzantine_bureaucracy_mechanic  
			power_type = logothete_waters_power
			value = -5
		}	
	}
}

country_event = {
	id = purple_phoenix.13
	
	title = "purple_phoenix.13.t"
	desc = "purple_phoenix.13.d"
	picture = BYZANTINE_EMPEROR_eventPicture
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		has_government_mechanic = byzantine_bureaucracy_mechanic
		OR = {
			NOT = { has_country_flag = recent_BYZ_factions }
			had_country_flag = { flag = recent_BYZ_factions days = 365 }
		}
	}
	
	immediate = { set_country_flag = recent_BYZ_factions }
	
	mean_time_to_happen = {
		months = 36
	}
	
	option = {
		name = "purple_phoenix.13.a"
		add_government_power = { 
			mechanic_type = byzantine_bureaucracy_mechanic  
			power_type = logothete_postal_power
			value = 5
		}	
		add_government_power = { 
			mechanic_type = byzantine_bureaucracy_mechanic  
			power_type = logothete_special_affairs_power
			value = 5
		}	
	}
}

country_event = {
	id = purple_phoenix.14
	
	title = "purple_phoenix.14.t"
	desc = "purple_phoenix.14.d"
	picture = BYZANTINE_EMPEROR_eventPicture
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		has_government_mechanic = byzantine_bureaucracy_mechanic
		OR = {
			NOT = { has_country_flag = recent_BYZ_factions }
			had_country_flag = { flag = recent_BYZ_factions days = 365 }
		}
	}
	
	immediate = { set_country_flag = recent_BYZ_factions }
	
	mean_time_to_happen = {
		months = 72
	}
	
	option = {
		name = "purple_phoenix.14.a"
		add_government_power = { 
			mechanic_type = byzantine_bureaucracy_mechanic  
			power_type = logothete_postal_power
			value = -5
		}	
		add_government_power = { 
			mechanic_type = byzantine_bureaucracy_mechanic  
			power_type = logothete_special_affairs_power
			value = -5
		}	
	}
}

country_event = {
	id = purple_phoenix.15
	
	title = "purple_phoenix.15.t"
	desc = "purple_phoenix.15.d"
	picture = GOOD_WITH_MONARCH_eventPicture
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		has_government_mechanic = byzantine_bureaucracy_mechanic
		OR = {
			NOT = { has_country_flag = recent_BYZ_factions }
			had_country_flag = { flag = recent_BYZ_factions days = 365 }
		}
	}
	
	immediate = { set_country_flag = recent_BYZ_factions }
	
	mean_time_to_happen = {
		months = 36
	}
	
	option = {
		name = "purple_phoenix.15.a"
		add_government_power = { 
			mechanic_type = byzantine_bureaucracy_mechanic  
			power_type = logothete_general_power
			value = 5
		}
		add_government_power = { 
			mechanic_type = byzantine_bureaucracy_mechanic  
			power_type = logothete_praetorium_power
			value = 5
		}
	}
}

country_event = {
	id = purple_phoenix.16
	
	title = "purple_phoenix.16.t"
	desc = "purple_phoenix.16.d"
	picture = BAD_WITH_MONARCH_eventPicture
	
	trigger = {
		tag = BYZ
		has_dlc = "Purple Phoenix"
		has_government_mechanic = byzantine_bureaucracy_mechanic
		OR = {
			NOT = { has_country_flag = recent_BYZ_factions }
			had_country_flag = { flag = recent_BYZ_factions days = 365 }
		}
	}
	
	immediate = { set_country_flag = recent_BYZ_factions }
	
	mean_time_to_happen = {
		months = 72
	}
	
	option = {
		name = "purple_phoenix.16.a"
		add_government_power = { 
			mechanic_type = byzantine_bureaucracy_mechanic  
			power_type = logothete_general_power
			value = -5
		}
		add_government_power = { 
			mechanic_type = byzantine_bureaucracy_mechanic  
			power_type = logothete_praetorium_power
			value = -5
		}
	}
}
 
