########################################
# Events for Nubia
#
# written by Johan Andersson
########################################

namespace = flavor_nub
normal_or_historical_nations = yes



# Spawn Funj
province_event = {
	id = flavor_nub.1
	title = flavor_nub.1.t
	desc = flavor_nub.1.d
	picture = RELIGIOUS_TURMOIL_eventPicture
	fire_only_once = yes

	trigger = {
		province_id = 1232
		NOT = { exists = NUB }
		is_year = 1500
		kurdufan_area = {
			is_empty = yes
		}
	}

	mean_time_to_happen = {
		months = 180
	}
	
	immediate = {
		hidden_effect = {
			every_province = {
				limit = {
					NOT = { owned_by = ROOT }
					OR = {
						area = kurdufan_area
						area = upper_nubia_area
						area = sennar_area
						province_id = 1219
						province_id = 2047
						province_id = 2665
					}
				}
				owner = {
					set_country_flag = funj_information
				}
			}
		}
	}
	
	option = { 
		name = flavor_nub.1.a
		every_country = {
			limit = { has_country_flag = funj_information }
			country_event = { id = flavor_nub.3 }
			clr_country_flag = funj_information
		}
		kurdufan_area = {
			add_core = NUB
		}
		sennar_area = {
			add_core = NUB
		}		
		upper_nubia_area = {
			add_core = NUB
		}
		1219 = {
			add_core = NUB
		}
		2047 = {
			add_core = NUB
		}
		2665 = {
			add_core = NUB
		}
		every_province = {
			limit = {
				is_empty = yes
				is_core = NUB
			}
			cede_province = NUB
		}
	}
}

country_event = {
	id = flavor_nub.2
	title = flavor_nub.2.t
	desc = flavor_nub.2.d
	picture = RELIGIOUS_TURMOIL_eventPicture
	fire_only_once = yes

	trigger = {
		tag = NUB
		religion_group = christian
		NOT = { stability = 3 }
	}

	mean_time_to_happen = {
		months = 240
	}
	
	
	option = { 
		name = flavor_nub.2.a
		ai_chance = { factor = 100 }
		change_religion = sunni
		every_neighbor_country = {
			limit = {
				religion_group = muslim
			}
			add_opinion = {
				who = ROOT
				modifier = funj_conversion_positive
			}
		}
		every_neighbor_country = {
			limit = {
				religion_group = christian
			}
			add_opinion = {
				who = ROOT
				modifier = funj_conversion_negative
			}
		}
	}
	option = { 
		name = flavor_nub.2.b
		ai_chance = { factor = 1 }
		add_stability_or_adm_power = yes
	}	
}

# Event to send to other province owners of the area when Funj is formed.
country_event = {
	id = flavor_nub.3
	title = flavor_nub.1.t
	desc = flavor_nub.1.d
	picture = RELIGIOUS_TURMOIL_eventPicture
	
	is_triggered_only = yes
	
	trigger = {
		NOT = { owns = 1232 }
	}

	option = {
		name = flavor_nub.1.a
		tooltip = {
			kurdufan_area = {
				add_core = NUB
			}		
			upper_nubia_area = {
				add_core = NUB
			}
			sennar_area = {
				add_core = NUB
			}
			1219 = {
				add_core = NUB
			}
			2047 = {
				add_core = NUB
			}
			2665 = {
				add_core = NUB
			}
		}
	}
}