namespace = Plus

#reserved: Plus.2300 to Plus.2350

#############################################
# MIAPHYSITE EVENTS
# Adapted from Bad Copt, Good Copt by Rylock
#############################################

### COPTIC CULTURE

# Christian Egyptian becomes Coptic
character_event = {
	id = Plus.2300
	desc = EVTDESC_Plus_2300
	picture = GFX_evt_courtiers_talking
	border = GFX_event_normal_frame_religion
	
	culture = egyptian_arabic
	religion_group = christian
	min_age = 16
	capable_only = yes
	prisoner = no
	
	trigger = {
		OR = {
			independent = yes
			liege = {
				NAND = {
					religion_group = christian
					culture = egyptian_arabic
				}
			}
		}
		is_nomadic = no
		mercenary = no
		NOT = { has_character_flag = no_melting_pot }
	}
	
	mean_time_to_happen = {
		months = 60
		modifier = {
			factor = 0.5
			liege = { culture = coptic }
		}
		modifier = {
			factor = 0.5
			location = { culture = coptic }
		}
		modifier = {
			factor = 2
			location = { NOT = { region = world_africa } }
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2300
		culture = coptic
		if = {
			limit = { is_ruler = no }
			any_spouse = {
				limit = {
					is_adult = no
					is_ruler = no
					religion = ROOT
					culture = egyptian_arabic
				}
				culture = ROOT
			}
			any_child = {
				limit = {
					is_adult = no
					is_ruler = no
					religion = ROOT
					culture = egyptian_arabic
				}
				culture = ROOT
			}
			set_character_flag = converted_culture
		}
		if = {
			limit = { is_ruler = yes }
			hidden_tooltip = {
				any_courtier = {
					limit = {
						is_ruler = no
						religion = ROOT
						culture = egyptian_arabic
						dynasty = ROOT
					}
					culture = ROOT
				}
			}
			set_character_flag = converted_culture
		}
	}
	option = {
		name = EVTOPTB_Plus_2300
		trigger = { ai = no }
		set_character_flag = no_melting_pot
	}
}

# Christian Egyptian province becomes Coptic
province_event = {
	id = Plus.2301
	desc = EVTDESC_Plus_2301
	picture = GFX_evt_courtiers_talking
	border = GFX_event_normal_frame_religion
	
	trigger = {
		culture = egyptian_arabic
		religion_group = christian
		OR = {
			region = world_africa
			any_neighbor_province = { culture = coptic }
		}
		owner = {
			NAND = {
				religion_group = christian
				culture = egyptian_arabic
			}
			NOT = { has_character_flag = no_melting_pot }
		}
		owner = {
			top_liege = {
				NAND = {
					religion_group = christian
					culture = egyptian_arabic
				}
				NOT = { has_character_flag = no_melting_pot }
			}
		}
	}
	
	mean_time_to_happen = {
		months = 900
		modifier = {
			factor = 0.5
			any_neighbor_province = { culture = coptic }
		}
		modifier = {
			factor = 0.5
			owner = { culture = coptic }
		}
	}
	
	option = {
		name = OK
		culture = coptic
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}

# Coptic character stops being Miaphysite
character_event = {
	id = Plus.2302
	desc = EVTDESC_Plus_2302
	picture = GFX_evt_courtiers_talking
	border = GFX_event_normal_frame_religion
	
	culture = coptic
	min_age = 16
	capable_only = yes
	prisoner = no
	
	trigger = {
		NOT = { religion_group = christian }
		OR = {
			independent = yes
			liege = {
				NAND = {
					NOT = { religion_group = christian }
					culture = coptic
				}
			}
		}
		is_nomadic = no
		mercenary = no
		NOT = { has_character_flag = no_melting_pot }
	}
	
	mean_time_to_happen = {
		months = 60
		modifier = {
			factor = 2
			liege = { culture = coptic }
		}
		modifier = {
			factor = 2
			location = { culture = coptic }
		}
		modifier = {
			factor = 0.5
			liege = { NOT = { culture = coptic } }
		}
		modifier = {
			factor = 0.5
			location = { NOT = { culture = coptic } }
		}
		modifier = {
			factor = 0.5
			location = { NOT = { region = world_africa } }
		}
	}
	
	option = {
		name = EVTOPTA_Plus_2302
		culture = egyptian_arabic
		if = {
			limit = { is_ruler = no }
			any_spouse = {
				limit = {
					is_adult = no
					is_ruler = no
					religion = ROOT
					culture = coptic
				}
				culture = ROOT
			}
			any_child = {
				limit = {
					is_adult = no
					is_ruler = no
					religion = ROOT
					culture = coptic
				}
				culture = ROOT
			}
			set_character_flag = converted_culture
		}
		if = {
			limit = { is_ruler = yes }
			hidden_tooltip = {
				any_courtier = {
					limit = {
						is_ruler = no
						religion = ROOT
						culture = coptic
						dynasty = ROOT
					}
					culture = ROOT
				}
			}
			set_character_flag = converted_culture
		}
	}
	option = {
		name = EVTOPTB_Plus_2302
		trigger = { ai = no }
		set_character_flag = no_melting_pot
	}
}

# Coptic province stops being Christian
province_event = {
	id = Plus.2303
	desc = EVTDESC_Plus_2303
	picture = GFX_evt_courtiers_talking
	border = GFX_event_normal_frame_religion
	
	trigger = {
		culture = coptic
		NOT = { religion_group = christian }
		any_neighbor_province = { 
			is_land = yes
			NOT = { culture = coptic }
		}
		owner = {
			NAND = {
				NOT = { religion_group = christian }
				culture = coptic
			}
			NOT = { has_character_flag = no_melting_pot }
		}
		owner = {
			top_liege = {
				NAND = {
					NOT = { religion_group = christian }
					culture = coptic
				}
				NOT = { has_character_flag = no_melting_pot }
			}
		}
	}
	
	mean_time_to_happen = {
		months = 900
		modifier = {
			factor = 0.5
			NOT = { any_neighbor_province = { culture = coptic } }
		}
		modifier = {
			factor = 2
			owner = { religion = miaphysite }
		}
		modifier = {
			factor = 0.5
			owner = { NOT = { culture = coptic } }
		}
	}
	
	option = {
		name = OK
		culture = egyptian_arabic
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}

# Desert Mother/Father moves on after staying a while
character_event = {
	id = Plus.2304
	
	hide_window = yes
	
	religion_group = christian
	capable_only = yes
	prisoner = no
	has_character_flag = is_desert_mother_father
	ai = yes
	war = no
	is_sick = no
	
	trigger = {
		#is_ill = no
		OR = {
			trait = desert_mother
			trait = desert_father
		}
		NOR = {
			any_liege = { war = yes }
			trait = wounded
			is_maimed_trigger = yes
			trait = infirm
		}
	}
	
	mean_time_to_happen = {
		months = 72
		modifier = {
			factor = 1.5
			is_councillor = yes
		}
		modifier = {
			factor = 2
			is_ruler = yes
		}
		modifier = {
			factor = 1.5
			liege = { reverse_opinion = { who = ROOT value = 25 } }
		}
		modifier = {
			factor = 0.5
			NOT = { liege = { reverse_opinion = { who = ROOT value = 0 } } }
		}
		modifier = {
			factor = 0.5
			NOT = { liege = { opinion = { who = ROOT value = 0 } } }
		}
	}
	
	immediate = {
		if = {
			limit = { is_ruler = yes }
			current_heir = {
				ROOT = { transfer_scaled_wealth = { to = PREV value = all } }
			}
			abdicate = yes
		}
		banish = yes
	}
}

