namespace = Plus

#reserved: Plus.2300 to Plus.2350

#############################################
# COPTIC 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

	is_triggered_only = yes # on_yearly_pulse, random_events

	religion_group = christian
	culture = egyptian_arabic
	min_age = 16
	only_capable = yes
	prisoner = no

	trigger = {
		trigger_if = {
			limit = { independent = no }

			liege = {
				NAND = {
					religion_group = christian
					culture = egyptian_arabic
				}
			}
		}

		is_nomadic = no
		mercenary = no
		NOT = { has_character_flag = no_melting_pot }
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 2
			liege = { culture = coptic }
		}

		mult_modifier = {
			factor = 2
			location = { culture = coptic }
		}

		mult_modifier = {
			factor = 0.5
			location = { NOT = { region = world_africa } }
		}
	}

	option = {
		name = EVTOPTA_Plus_2300

		culture = coptic
		set_character_flag = converted_culture

		hidden_effect = {
			if = {
				limit = { is_ruler = yes }

				any_courtier = {
					limit = {
						dynasty = ROOT
						religion = ROOT
						culture = egyptian_arabic
						is_ruler = no
					}

					culture = ROOT
				}
			}

			else = {
				any_spouse = {
					limit = {
						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
				}
			}
		}
	}

	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 }

			top_liege = {
				NAND = {
					religion_group = christian
					culture = egyptian_arabic
				}

				NOT = { has_character_flag = no_melting_pot }
			}
		}
	}

	mean_time_to_happen = {
		years = 75

		mult_modifier = {
			factor = 0.5
			any_neighbor_province = { culture = coptic }
		}

		mult_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/Kemetic
character_event = {
	id = Plus.2302
	desc = EVTDESC_Plus_2302
	picture = GFX_evt_courtiers_talking
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes # on_yearly_pulse, random_events

	culture = coptic
	min_age = 16
	only_capable = yes
	prisoner = no

	trigger = {
		NOR = {
			religion_group = christian
			religion = egyptian_pagan
			religion = aten_pagan
			has_character_flag = no_melting_pot
		}

		trigger_if = {
			limit = { independent = no }

			liege = {
				OR = {
					religion_group = christian
					religion = egyptian_pagan
					religion = aten_pagan
					NOT = { culture = coptic }
				}
			}
		}

		is_nomadic = no
		mercenary = no
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 0.5
			liege = { culture = coptic }
		}

		mult_modifier = {
			factor = 0.5
			location = { culture = coptic }
		}

		mult_modifier = {
			factor = 2
			liege = { NOT = { culture = coptic } }
		}

		mult_modifier = {
			factor = 2
			location = { NOT = { culture = coptic } }
		}

		mult_modifier = {
			factor = 2
			location = { NOT = { region = world_africa } }
		}
	}

	option = {
		name = EVTOPTA_Plus_2302

		culture = egyptian_arabic
		set_character_flag = converted_culture

		hidden_effect = {
			if = {
				limit = { is_ruler = yes }

				any_courtier = {
					limit = {
						dynasty = ROOT
						culture = coptic
						religion = ROOT
							is_ruler = no
					}

					culture = ROOT
				}
			}
			else = {
				any_spouse = {
					limit = {
						is_ruler = no
						religion = ROOT
						culture = coptic
					}

					culture = ROOT
				}

				any_child = {
					limit = {
						is_adult = no
						is_ruler = no
						religion = ROOT
						culture = coptic
					}

					culture = ROOT
				}
			}
		}
	}

	option = {
		name = EVTOPTB_Plus_2302

		trigger = { ai = no }

		set_character_flag = no_melting_pot
	}
}

# Coptic province stops being Christian/Kemetic
province_event = {
	id = Plus.2303
	desc = EVTDESC_Plus_2303
	picture = GFX_evt_courtiers_talking
	border = GFX_event_normal_frame_religion

	trigger = {
		culture = coptic

		NOR = {
			religion_group = christian
			religion = egyptian_pagan
			religion = aten_pagan
		}

		any_neighbor_province = {
			is_land = yes
			NOT = { culture = coptic }
		}

		owner = {
			OR = {
				religion_group = christian
				religion = egyptian_pagan
				religion = aten_pagan
				NOT = { culture = coptic }
			}

			NOT = { has_character_flag = no_melting_pot }

			top_liege = {
				OR = {
					religion_group = christian
					religion = egyptian_pagan
					religion = aten_pagan
					NOT = { culture = coptic }
				}

				NOT = { has_character_flag = no_melting_pot }
			}
		}
	}

	mean_time_to_happen = {
		years = 75

		mult_modifier = {
			factor = 0.5
			NOT = { any_neighbor_province = { culture = coptic } }
		}

		mult_modifier = {
			factor = 2
			owner = { religion = miaphysite }
		}

		mult_modifier = {
			factor = 2
			owner = { religion = egyptian_pagan }
		}

		mult_modifier = {
			factor = 2
			owner = { religion = aten_pagan }
		}

		mult_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

	is_triggered_only = yes
	hide_window = yes

	religion_group = christian
	has_character_flag = is_desert_mother_father
	only_capable = yes
	prisoner = no
	ai = yes
	war = no
	is_sick = no

	trigger = {
		OR = {
			trait = desert_mother
			trait = desert_father
		}

		is_maimed_trigger = no

		NOR = {
			any_liege = { war = yes }
			trait = wounded
			trait = infirm
		}
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 0.67
			is_councillor = yes
		}

		mult_modifier = {
			factor = 0.5
			is_ruler = yes
		}

		mult_modifier = {
			factor = 0.67
			opinion = { who = liege value >= 25 }
		}

		mult_modifier = {
			factor = 2
			opinion = { who = liege value < 0 }
		}

		mult_modifier = {
			factor = 2
			reverse_opinion = { who = liege value < 0 }
		}
	}

	immediate = {
		if = {
			limit = { is_ruler = yes }

			transfer_scaled_wealth = {
				to = current_heir
				value = all
			}

			abdicate = yes

			# TODO: Transfer artifacts?
		}

		banish = yes
	}
}

### KEMETIC

# Kemetic Egyptian becomes Coptic
character_event = {
	id = Plus.2305
	desc = EVTDESC_Plus_2305
	picture = GFX_evt_courtiers_talking
	border = GFX_event_normal_frame_religion

	is_triggered_only = yes

	culture = egyptian_arabic
	min_age = 16
	only_capable = yes
	prisoner = no

	trigger = {
		religion_openly_egyptian_or_reformed_trigger = yes

		trigger_if = {
			limit = { independent = no }

			liege = {
				trigger_if = {
					limit = { culture = egyptian_arabic }
					religion_openly_egyptian_or_reformed_trigger = no
				}
			}
		}

		is_nomadic = no
		mercenary = no
		NOT = { has_character_flag = no_melting_pot }
	}

	weight_multiplier = {
		factor = 1

		mult_modifier = {
			factor = 2
			liege = { culture = coptic }
		}

		mult_modifier = {
			factor = 2
			location = { culture = coptic }
		}

		mult_modifier = {
			factor = 0.5
			location = { NOT = { region = world_africa } }
		}
	}

	option = {
		name = EVTOPTA_Plus_2300

		culture = coptic
		set_character_flag = converted_culture

		hidden_effect = {
			if = {
				limit = { is_ruler = yes }

				any_courtier = {
					limit = {
						dynasty = ROOT
						religion = ROOT
						culture = egyptian_arabic
						is_ruler = no
					}

					culture = ROOT
				}
			}
			else = {
				any_spouse = {
					limit = {
						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
				}
			}
		}
	}

	option = {
		name = EVTOPTB_Plus_2300

		trigger = { ai = no }

		set_character_flag = no_melting_pot
	}
}

# Kemetic province becomes Coptic
province_event = {
	id = Plus.2306
	desc = EVTDESC_Plus_2301
	picture = GFX_evt_courtiers_talking
	border = GFX_event_normal_frame_religion

	trigger = {
		OR = {
			religion = egyptian_pagan
			religion = aten_pagan
		}

		culture = egyptian_arabic

		OR = {
			region = world_africa
			any_neighbor_province = { culture = coptic }
		}

		owner = {
			NAND = {
				religion_openly_egyptian_or_reformed_trigger = yes
				culture = egyptian_arabic
			}

			NOT = { has_character_flag = no_melting_pot }

			top_liege = {
				NAND = {
					religion_openly_egyptian_or_reformed_trigger = yes
					culture = egyptian_arabic
				}

				NOT = { has_character_flag = no_melting_pot }
			}
		}
	}

	mean_time_to_happen = {
		years = 75

		mult_modifier = {
			factor = 0.5
			any_neighbor_province = { culture = coptic }
		}

		mult_modifier = {
			factor = 0.5
			owner = { culture = coptic }
		}
	}

	option = {
		name = OK

		culture = coptic

		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}