# -*- ck2.events -*-

namespace = emf_culture

#### GENERIC CUSTOM CULTURE CONVERSION EVENTS ####

# NOTE: currently includes norsegaelic melting pot as a holdover from PB, but that will be refactored and moved to emf_melt
# (someday soon hopefully?)

# Province culture changes
province_event = {
	id = emf_culture.0
	desc = "EVTDESC55000" # FIXME
	picture = GFX_evt_market
	border = GFX_event_normal_frame_diplomacy

	trigger = {
		owner = {
			NOT = { culture = ROOT }
			religion = ROOT
		}
		any_province_holding = {
			NOT = { holding_type = nomad }
		}
		any_neighbor_province = {
			has_owner = yes
			owner = { culture = PREV }
			ROOT = {
				owner = { culture = PREVPREV }
			}
			NOR = {
				has_province_modifier = depopulated_1
				has_province_modifier = depopulated_2
				has_province_modifier = depopulated_3
			}
		}
		NOT = { # No flipping back to Norse culture before 1150
			AND = {
				NOT = { has_global_flag = norse_culture_flipping }
				owner = { culture = norse }
				ROOT = {
					OR = {
						culture = swedish
						culture = norwegian
						culture = danish
						culture = norman
						culture = gothic
						culture = icelandic
					}
				}
			}
		}
		# These setups use melting pot events instead
		NOT = {
			AND = {
				culture_group = celtic
				owner = { culture_group = north_germanic }
			}
		}
		emf_is_province_protected_by_english_melt = no
		emf_is_province_protected_by_neapolitan_melt = no
		emf_is_province_protected_by_sicilian_melt = no
		emf_is_province_protected_by_sicilian_arabic_melt = no
	}

	mean_time_to_happen = {
		months = 3000

		modifier = {
			factor = 0.8
			owner = {
				OR = {
					has_ambition = obj_civilize_province
					any_liege = {
						culture = PREV
						has_ambition = obj_civilize_province
					}
				}
			}
		}
		modifier = {
			factor = 0.75
			port = yes
		}
		modifier = {
			factor = 0.4
			NOT = {
				any_neighbor_province = { culture = ROOT }
			}
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 2 } }
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 3 } }
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 4 } }
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 5 } }
		}
		modifier = {
			factor = 0.84
			owner = { stewardship = 10 }
		}
		modifier = {
			factor = 0.84
			owner = { stewardship = 11 }
		}
		modifier = {
			factor = 0.84
			owner = { stewardship = 12 }
		}
		modifier = {
			factor = 0.84
			owner = { stewardship = 13 }
		}
		modifier = {
			factor = 0.95
			owner = {
				job_treasurer = {
					stewardship < 10
					has_job_action = action_administer_realm
					in_seclusion = no
				}
			}
		}
		modifier = {
			factor = 0.75
			owner = {
				job_treasurer = {
					stewardship >= 10
					has_job_action = action_administer_realm
					in_seclusion = no
				}
			}
		}
		modifier = {
			factor = 0.75
			owner = {
				OR = {
					primary_title = { conquest_culture = PREV }
					ROOT = {
						county = { conquest_culture = PREVPREV }
					}
					ROOT = {
						duchy = {
							holder = PREVPREV
							conquest_culture = PREVPREV
						}
					}
					ROOT = {
						kingdom = {
							holder = PREVPREV
							conquest_culture = PREVPREV
						}
					}
					ROOT = {
						empire = {
							holder = PREVPREV
							conquest_culture = PREVPREV
						}
					}
				}
			}
		}
		# Counties controlled directly by the Pope (or Archegos, etc.) should take longer to flip culture to the current Pope
		# due to how foreign their culture can be upon papal succession and how rapid their succession frequency is. Popes
		# aren't concerned too much about local peasant culture so much as religion.
		modifier = {
			factor = 6.0
			owner = {
				is_theocracy = yes
				primary_title = { succ_law_title = { has_law = succ_papal_succession } }
			}
		}
		modifier = { # Non-nomadic provinces shouldn't convert to Mongol much
			factor = 2.0
			owner = {
				culture = mongol
				NOR = { # Don't railroad players
					ai = no
					any_liege = {
						culture = PREV
						ai = no
					}
				}
			}
		}
		modifier = { # Turkish culture didn't spread to coasts much
			factor = 3
			NOT = { year = 1250 }
			port = yes
			owner = {
				OR = {
					culture = turkish
					culture = turkmen
				}
				NOR = { # Don't railroad players
					ai = no
					any_liege = {
						culture = PREV
						ai = no
					}
				}
			}
			county = {
				OR = {
					de_jure_liege_or_above = k_rum
					de_jure_liege_or_above = e_byzantium
				}
			}
		}
		modifier = { # Turkish culture spread quickly inland
			factor = 0.3
			NOT = { year = 1250 }
			port = no
			owner = {
				OR = {
					culture = turkish
					culture = turkmen
				}
				NOR = { # Don't railroad players
					ai = no
					any_liege = {
						culture = PREV
						ai = no
					}
				}
			}
			county = {
				OR = {
					de_jure_liege_or_above = k_rum
					de_jure_liege_or_above = e_byzantium
				}
			}
		}
		modifier = {
			factor = 0.95
			owner = {
				OR = {
					culture = pommeranian
					culture = polish
					culture = bohemian
					culture = slovieni
					culture = russian
					culture = bulgarian
					culture = serbian
					culture = bosnian
					culture = croatian
					culture = carantanian
					culture = paeonian
                    culture = sorbian
                    culture = volhynian
                    culture = ilmenian
                    culture = severian
					culture = romanian
				}
			}
			ROOT = { 
				OR = {
					culture = avar
					culture = bolghar
				}
			}
		}
		modifier = {
			factor = 0.95
			owner = { culture = paeonian }
			ROOT = { culture = bulgarian }
		}
        modifier = {
			factor = 6
			owner = {
				culture = bolghar
				top_liege = {
					has_landed_title = k_bulgaria
				}
			}
		}
		modifier = {
			factor = 6
			owner = {
				culture = greek
				top_liege = {
					has_landed_title = e_byzantium
				}
				crownlaw_title = {
					ROOT = { owner = { top_liege = { has_landed_title = PREVPREVPREV } } }
					emf_laws_has_high_ca_plus = no
				}
			}
		}
		modifier = {
			factor = 0.75
			has_flag = recent_depopulation_1
		}
		modifier = {
			factor = 0.5
			has_flag = recent_depopulation_2
		}
		modifier = {
			factor = 0.25
			has_flag = recent_depopulation_3
		}
		modifier = {
			factor = 3
			OR = {
				has_game_rule = {
					name = culture_conversion
					value = slower_normal
				}
				has_game_rule = {
					name = culture_conversion
					value = faster_melting_pots_and_slower_normal
				}
			}
		}
		modifier = {
			factor = 0.25
			OR = {
				culture = zhangzhung
				culture = sumpa
			}
			owner = {
				culture = bodpa
				OR = {
					any_owned_bloodline = {
						has_bloodline_flag = bloodline_songtsen_gampo
						bloodline_is_active_for = PREV
					}
					top_liege = {
						any_owned_bloodline = {
							has_bloodline_flag = bloodline_songtsen_gampo
							bloodline_is_active_for = PREV
						}
					}
				}
			}
		}
		modifier = {
			factor = 0.6
			owner = {
		    	any_owned_bloodline = {
    				has_bloodline_flag = cultural_saintly_bloodline
					bloodline_is_active_for = PREV
    				founder = {
    					culture = PREVPREV
    				}
    			}
			}
		}
		modifier = { #Roman Renaissance.
			factor = 0.3
			owner = {
				culture = roman
			}
			ROOT = { 
				OR = {
                    culture = laziale
                    culture = sardinian
                    culture = umbrian
                    culture = tuscan
                    culture = venetian
                    culture = dalmatian
				}
			}
		}
        modifier = {
			factor = 0.4
			owner = {
				culture = roman
			}
			ROOT = { 
				OR = {
                    culture = ligurian
                    culture = italian
                    culture = neapolitan
                    culture = sicilian
				}
			}
		}
        modifier = {
			factor = 0.5
			owner = {
				culture = roman
			}
			ROOT = { 
				OR = {
                    culture = occitan
                    culture = catalan
                    culture = arpitan
                    culture = langobardisch
                    culture = romanian
				}
			}
		}
        modifier = {
			factor = 0.6
			owner = {
				culture = roman
			}
			ROOT = { 
				OR = {
                    culture = castillan
                    culture = leonese
                    culture = portuguese
                    culture = galician
                    culture = aragonese
                    culture = frankish
                    culture = visigothic
				}
			}
		}
        modifier = {
			factor = 0.7
			owner = {
				culture = roman
			}
			ROOT = { 
				OR = {
                    culture = norman
                    culture = andalusian_arabic
                    culture = outremer
				}
			}
		}
		modifier = {
			factor = 0.75
			owner = {
				culture = roman
	    		any_owned_bloodline = {
    				has_bloodline_flag = bloodline_faster_roman
					bloodline_is_active_for = PREV
    			}
			}
		}
		modifier = { #Greek culture is more impervious to Romanization.
			factor = 2
			owner = { culture = roman }
			ROOT = { culture = greek }
		}
		# Effect of wonder upgrades
		modifier = {
			factor = 0.75
			owner = {
				top_liege = {
					any_realm_wonder_upgrade = {
						has_wonder_upgrade_flag = culture_conversion_faster
						is_active = yes
						wonder = {
							original_wonder_owner = {
								culture_group = PREVPREVPREV
							}
						}
					}
				}
			} 
		}
	}

	option = {
		name = "EVTOPTA55000"
		save_event_target_as = emf_province
		owner = {
			ROOT = {
				culture = PREV
				if = {
					limit = {
						has_province_modifier = nomad_agitation
					}
					remove_province_modifier = nomad_agitation
				}
			}
			hidden_tooltip = {
				character_event = { id = emf_ambitions.1 }
				any_liege = { character_event = { id = emf_ambitions.1 } }
			}
		}
	}
}

# Culture spread via port
province_event = {
	id = emf_culture.1
	desc = "EVTDESC55001" # FIXME
	picture = GFX_evt_busy_trading_dock_republic
	border = GFX_event_normal_frame_diplomacy

	trigger = {
		any_province_holding = {
			NOT = { holding_type = nomad }
		}
		owner = {
			top_liege = {
				culture = PREV
				any_realm_province = {
					port = yes
					culture = PREV
				}
			}
			NOT = { culture = ROOT }
		}
		OR = {
			port = yes
			NOR = {
				has_game_rule = {
					name = culture_conversion
					value = restricted
				}
				has_game_rule = {
					name = culture_conversion
					value = faster_melting_pots_and_slower_normal
				}
			}
		}
		NOT = { # No flipping back to Norse culture before 1150
			AND = {
				NOT = { has_global_flag = norse_culture_flipping }
				owner = { culture = norse }
				ROOT = {
					OR = {
						culture = swedish
						culture = norwegian
						culture = danish
						culture = norman
						culture = gothic
						culture = icelandic
					}
				}
			}
		}
		#These setups use melting pot events instead
		NOT = {
			AND = {
				culture_group = celtic
				owner = { culture_group = north_germanic }
			}
		}
		emf_is_province_protected_by_english_melt = no
		emf_is_province_protected_by_neapolitan_melt = no
		emf_is_province_protected_by_sicilian_melt = no
		emf_is_province_protected_by_sicilian_arabic_melt = no
	}

	mean_time_to_happen = {
		months = 4000

		modifier = {
			factor = 0.8
			owner = {
				OR = {
					has_ambition = obj_civilize_province
					any_liege = {
						culture = PREV
						has_ambition = obj_civilize_province
					}
				}
			}
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 2 } }
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 3 } }
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 4 } }
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 5 } }
		}
		modifier = {
			factor = 0.84
			owner = { stewardship = 10 }
		}
		modifier = {
			factor = 0.84
			owner = { stewardship = 11}
		}
		modifier = {
			factor = 0.84
			owner = { stewardship = 12 }
		}
		modifier = {
			factor = 0.84
			owner = { stewardship = 13 }
		}
		modifier = {
			factor = 0.75
			has_flag = recent_depopulation_1
		}
		modifier = {
			factor = 0.5
			has_flag = recent_depopulation_2
		}
		modifier = {
			factor = 0.25
			has_flag = recent_depopulation_3
		}
		# Counties controlled directly by the Pope (or Archegos, etc.) should take longer to flip culture to the current Pope
		# due to how foreign their culture can be upon papal succession and how rapid their succession frequency is. Popes
		# aren't concerned too much about local peasant culture so much as religion.
		modifier = {
			factor = 6.0
			owner = {
				is_theocracy = yes
				primary_title = { succ_law_title = { has_law = succ_papal_succession } }
			}
		}
		modifier = {
			factor = 6
			owner = {
				culture = greek
				top_liege = {
					has_landed_title = e_byzantium
				}
				crownlaw_title = {
					ROOT = { owner = { top_liege = { has_landed_title = PREVPREVPREV } } }
					emf_laws_has_high_ca_plus = no
				}
			}
		}
		modifier = {
			factor = 6
			owner = {
				culture = bolghar
				top_liege = {
					has_landed_title = k_bulgaria
				}
			}
		}
		modifier = {
			factor = 3
			OR = {
				has_game_rule = {
					name = culture_conversion
					value = slower_normal
				}
				has_game_rule = {
					name = culture_conversion
					value = faster_melting_pots_and_slower_normal
				}
			}
		}
		modifier = {
			factor = 0.25
			OR = {
				culture = zhangzhung
				culture = sumpa
			}
			owner = {
				culture = bodpa
				OR = {
					any_owned_bloodline = {
						has_bloodline_flag = bloodline_songtsen_gampo
						bloodline_is_active_for = PREV
					}
					top_liege = {
						any_owned_bloodline = {
							has_bloodline_flag = bloodline_songtsen_gampo
							bloodline_is_active_for = PREV
						}
					}
				}
			}
		}
		modifier = {
			factor = 0.6
			owner = {
		    	any_owned_bloodline = {
    				has_bloodline_flag = cultural_saintly_bloodline
					bloodline_is_active_for = PREV
    				founder = {
    					culture = PREVPREV
    				}
    			}
			}
		}
		# Effect of wonder upgrades
		modifier = {
			factor = 0.75
			owner = {
				top_liege = {
					any_realm_wonder_upgrade = {
						has_wonder_upgrade_flag = culture_conversion_faster
						is_active = yes
						wonder = {
							original_wonder_owner = {
								culture_group = PREVPREVPREV
							}
						}
					}
				}
			} 
		}
	}

	option = {
		name = "EVTOPTA55001"
		save_event_target_as = emf_province
		owner = {
			ROOT = {
				culture = PREV
				if = {
					limit = {
						NOT = { religion = PREV }
					}
					religion = PREV
				}
				if = {
					limit = {
						has_province_modifier = nomad_agitation
					}
					remove_province_modifier = nomad_agitation
				}
			}
			hidden_tooltip = {
				character_event = { id = emf_ambitions.1 }
				any_liege = { character_event = { id = emf_ambitions.1 } }
			}
		}
	}
}

#Rulers' culture changed to that of his capital
character_event = {
	id = emf_culture.5
	desc = emf_culture.05.desc
	picture = GFX_evt_culture_change
	border = GFX_event_normal_frame_diplomacy

	only_playable = yes

	trigger = {
		primary_title = { is_landless_type_title = no }
		emf_can_convert_culture = yes
		capital_scope = {
			NOT = { culture = ROOT }
			religion = ROOT
			# Prevent silly stuff
			NAND = {
				ROOT = { religion_group = christian }
				OR = {
					culture_group = arabic
					culture = andalusian_arabic
					culture_group = israelite
				}
			}
			NAND = {
				ROOT = { culture = pecheneg }
				culture = romanian
			}
			NOT = { culture = nahuatl }
			# Melting pot exemption (Norsegael)
			NAND = {
				ROOT = { culture_group = celtic }
				culture_group = north_germanic
			}
			trigger_if = {
				limit = { has_random_culture_names = no }
				# Melting pot exemptions:
				ROOT = {
					emf_is_ruler_protected_by_english_melt = no
					emf_is_ruler_protected_by_neapolitan_melt = no
					emf_is_ruler_protected_by_sicilian_melt = no
					emf_is_ruler_protected_by_sicilian_arabic_melt = no
                    emf_is_ruler_protected_by_bulgarian_melt = no
				}
				emf_THIS_culture_is_older_version_of_ROOTs = no
				# Saxon/Anglonorse nobility will not switch to become Normans
				trigger_if = {
					limit = { culture = saxon }
					NOT = { ROOT = { culture = norman } }
				}
				trigger_else_if = {
					limit = {
						emf_has_swmh = yes
						culture = anglonorse
					}
					NOT = { ROOT = { culture = norman } }
				}
				# Norse/Norman shouldn't convert to anything else but Norman locally in Normandy:
				trigger_else_if = {
					limit = {
						NOT = { culture = norman }
						duchy = { title = d_normandy }
					}
					ROOT = {
						NOR = {
							culture = norse
							culture = norman
						}
					}
				}
			}
		}
		NOT = { government = chinese_imperial_government }
	}

	mean_time_to_happen = {
		months = 900
		modifier = {
			factor = 0.5
			capital_scope = { culture_group = ROOT }
		}
		modifier = {
			factor = 0.75
			lower_real_tier_than = DUKE
		}
		modifier = {
			factor = 2
			real_tier = DUKE
		}
		modifier = {
			factor = 5
			real_tier = KING
		}
		modifier = {
			factor = 10
			real_tier = EMPEROR
		}
		modifier = {
			factor = 0.75
			NOT = { age = 10 }
		}
		modifier = {
			factor = 1.1
			age = 10
		}
		modifier = {
			factor = 1.1
			age = 16
		}
		modifier = {
			factor = 1.2
			age = 20
		}
		modifier = {
			factor = 1.35
			age = 30
		}
		modifier = {
			factor = 1.5
			age = 40
		}
		modifier = {
			factor = 2
			age = 50
		}
		modifier = {
			factor = 2
			age = 60
		}
		modifier = {
			factor = 0.75
			NOT = {
				capital_scope = {
					any_neighbor_province = { culture = ROOT }
				}
			}
		}
		modifier = {
			factor = 2
			is_patrician = yes
		}
	}

	immediate = {
		capital_scope = { save_event_target_as = emf_capital }
		culture_scope = { save_event_target_as = emf_old_culture }
	}

	option = {
		name = emf_culture.05.opt.embrace
		culture = event_target:emf_capital
		# Convert appropriate non-adult courtiers in our family:
		any_courtier = {
			limit = {
				vassal_of = ROOT
				is_ruler = no
				NOT = { culture = event_target:emf_capital }
				emf_can_convert_culture = yes
				OR = {
					obedient = ROOT
					AND = {
						is_adult = no
						OR = {
							dynasty = ROOT
							is_close_relative = ROOT
							is_cousin_of = ROOT
							father_even_if_dead = { is_grandchild_of = ROOT }
							mother_even_if_dead = { is_grandchild_of = ROOT }
						}
					}
				}
			}
			culture = event_target:emf_capital
		}
		# Convert non-playable vassal barons of the same prior culture that aren't prisoners or foes:
		any_vassal = {
			limit = {
				real_tier = BARON
				is_playable = no # Patricians convert the normal way
				NOT = { culture = event_target:emf_capital }
				emf_can_convert_culture = yes
				OR = {
					prisoner = no
					AND = {
						obedient = ROOT
						host = { character = ROOT }
					}
				}
				OR = {
					obedient = ROOT
					AND = {
						culture = event_target:emf_old_culture
						NOT = { is_foe = ROOT }
					}
				}
			}
			culture = event_target:emf_capital
		}
	}
	option = {
		name = emf_culture.05.opt.resist
		trigger = { ai = no }
	}
}


# emf_culture.10 -- AI ruler converts to liege's culture (governed by 'Liege Culture Conversion' game rule)
character_event = {
	id = emf_culture.10
	hide_window = yes

	only_playable = yes
	only_capable = yes
	prisoner = no
	ai = yes

	trigger = {
		NOT = { has_game_rule = { name = liege_culture_conversion value = off } }
		independent = no
		in_revolt = no
		emf_can_convert_culture = yes
		liege = {
			NOT = { culture = ROOT }
			religion = ROOT
			in_revolt = no
			OR = {
				is_nomadic = no
				ROOT = { is_nomadic = yes }
			}
			NOT = { ROOT = { is_foe = PREV } }
		}
		opinion = { who = LIEGE value = -20 }
		# Melting pot exemptions:
		trigger_if = {
			limit = { has_random_culture_names = no }
			# Vanilla melting pots:
			NAND = {
				culture = scottish
				liege = { culture = pictish }
			}
			# Vanilla melting pots only relevant to 769:
			trigger_if = {
				limit = { start_date < 867.1.1 }
				NAND = {
					culture = russian
					liege = { culture_group = east_slavic }
				}
				NAND = {
					culture = italian
					liege = { culture = lombard }
				}
				NAND = {
					culture = frankish
					liege = { culture = old_frankish }
				}
				NAND = {
					culture = dutch
					liege = { culture = frisian }
				}
				NAND = {
					culture = german
					liege = { culture = old_saxon }
				}
				NAND = {
					OR = {
						culture_group = iberian
						culture = andalusian_arabic
						culture = occitan
						religion_group = muslim
					}
					liege = { culture = visigothic }
				}
			}
			# Melting pots that use the latest EMF melting pot model:
			emf_is_ruler_protected_by_english_melt = no
			emf_is_ruler_protected_by_neapolitan_melt = no
			emf_is_ruler_protected_by_sicilian_melt = no
			emf_is_ruler_protected_by_sicilian_arabic_melt = no
			# SWMH-only melting pots:
			trigger_if = {
				limit = { emf_has_swmh = yes }
				NAND = {
					culture = german
					liege = {
						OR = {
							culture = franconian
							culture = bavarian
							culture = swabian
							culture = thuringian
						}
					}
				}
				NAND = {
					culture = low_german
					liege = { culture = low_saxon }
				}
				NAND = {
					culture = dutch
					liege = { culture = low_frankish }
				}
				NAND = {
					culture = turkmen
					liege = { culture = oghuz }
				}
				NAND = {
					culture = turkish
					liege = { culture = turkmen }
				}
			}
			# Prevent Normans in Normandy from converting to anything else:
			NAND = {
				OR = {
					culture = norman
					culture = norse
				}
				NOT = { liege = { culture = norman } }
				capital_scope = { duchy = { title = d_normandy } }
			}
			# Norse cultural split:
			NAND = {
				NOT = { has_global_flag = norse_culture_flipping }
				liege = { culture = norse }
				OR = {
					culture = swedish
					culture = norwegian
					culture = danish
					culture = norman
					culture = gothic
					culture = icelandic
				}
			}
			# Norse-Gael melting pot:
			NAND = {
				culture_group = celtic
				liege = { culture_group = north_germanic }
				capital_scope = { culture_group = ROOT } # FIXME: not sure if this is actually correct
			}
		}
		NOT = { government = chinese_imperial_government }
	}

	mean_time_to_happen = {
		months = 1800 # 150 years

		# Base speed adjustments due to game rule setting:
		additive_modifier = {
			value = 3600 # +300 years = 450 years (3x Medium)
			has_game_rule = { name = liege_culture_conversion value = slowest }
		}
		additive_modifier = {
			value = 1800 # +150 years = 300 years (2x Medium)
			has_game_rule = { name = liege_culture_conversion value = slow }
		}
		# Setting of 'Medium' == 150 years
		additive_modifier = {
			value = -900 # -75 years = 75 years (1/2x Medium)
			has_game_rule = { name = liege_culture_conversion value = fast }
		}
		additive_modifier = {
			value = -1200 # -100 years = 50 years (1/3x Medium)
			has_game_rule = { name = liege_culture_conversion value = fastest }
		}
		# Ruler age:
		modifier = {
			factor = 0.85
			age < 2
		}
		modifier = {
			factor = 0.85
			age < 4
		}
		modifier = {
			factor = 0.85
			age < 6
		}
		modifier = {
			factor = 0.85
			age < 8
		}
		modifier = {
			factor = 0.85
			age < 10
		}
		modifier = {
			factor = 0.85
			age < 12
		}
		modifier = {
			factor = 0.85
			age < 14
		}
		modifier = {
			factor = 0.85
			age < 16
		}
		modifier = {
			factor = 0.85
			age < 18
		}
		modifier = {
			factor = 0.85
			age <= 20
		}
		modifier = {
			factor = 1.15
			age > 32
		}
		modifier = {
			factor = 1.15
			age > 34
		}
		modifier = {
			factor = 1.15
			age > 36
		}
		modifier = {
			factor = 1.15
			age > 38
		}
		modifier = {
			factor = 1.15
			age > 40
		}
		modifier = {
			factor = 1.15
			age > 42
		}
		modifier = {
			factor = 1.15
			age > 44
		}
		modifier = {
			factor = 1.15
			age > 46
		}
		modifier = {
			factor = 1.15
			age > 48
		}
		modifier = {
			factor = 1.15
			age > 50
		}
		modifier = {
			factor = 1.15
			age > 52
		}
		modifier = {
			factor = 1.15
			age > 54
		}
		modifier = {
			factor = 1.15
			age > 56
		}
		modifier = {
			factor = 1.15
			age > 58
		}
		# Opinion of liege (min. allowed is -20):
		modifier = {
			factor = 1.5
			NOT = { opinion = { who = LIEGE value = -10 } }
		}
		modifier = {
			factor = 1.5
			NOT = { opinion = { who = LIEGE value = 0 } }
		}
		modifier = {
			factor = 0.8
			opinion = { who = LIEGE value = 20 }
		}
		modifier = {
			factor = 0.8
			opinion = { who = LIEGE value = 40 }
		}
		modifier = {
			factor = 0.8
			opinion = { who = LIEGE value = 60 }
		}
		modifier = {
			factor = 0.8
			opinion = { who = LIEGE value = 80 }
		}
		# Learning skill:
		modifier = {
			factor = 1.5
			learning <= 1
		}
		modifier = {
			factor = 1.5
			learning <= 2
		}
		modifier = {
			factor = 1.5
			learning <= 3
		}
		modifier = {
			factor = 1.5
			learning <= 4
		}
		modifier = {
			factor = 0.85
			learning >= 8
		}
		modifier = {
			factor = 0.85
			learning >= 10
		}
		modifier = {
			factor = 0.85
			learning >= 12
		}
		modifier = {
			factor = 0.85
			learning >= 14
		}
		modifier = {
			factor = 0.85
			learning >= 16
		}
		modifier = {
			factor = 0.85
			learning >= 18
		}
		modifier = {
			factor = 0.85
			learning >= 20
		}
		# Different culture group as liege:
		modifier = {
			factor = 2.0
			NOT = { liege = { culture_group = ROOT } }
            NAND = { #Roman Renaissance.
                liege = { culture = roman }
                ROOT = {
                    OR = {
                        culture = laziale
                        culture = sardinian
                        culture = umbrian
                        culture = tuscan
                        culture = venetian
                        culture = dalmatian
                        culture = occitan
                        culture = catalan
                        culture = arpitan
                        culture = romanian
                        culture = castillan
                        culture = leonese
                        culture = portuguese
                        culture = galician
                        culture = aragonese
                        culture = frankish
                        culture = visigothic
                        culture = norman
                        culture = andalusian_arabic
                        culture = outremer
                    }
                }
            }
		}
        modifier = {
			factor = 0.75
            liege = { culture = roman }
            ROOT = {
                OR = {
                    culture = laziale
                    culture = sardinian
                    culture = umbrian
                    culture = tuscan
                    culture = venetian
                    culture = dalmatian
                }
            }
		}
        modifier = {
			factor = 1.25
            liege = { culture = roman }
            ROOT = {
                OR = {
                    culture = occitan
                    culture = catalan
                    culture = arpitan
                    culture = romanian
                    culture = langobardisch
                }
            }
		}
        modifier = {
			factor = 1.5
            liege = { culture = roman }
            ROOT = {
                OR = {
                    culture = castillan
                    culture = leonese
                    culture = portuguese
                    culture = galician
                    culture = aragonese
                    culture = frankish
                    culture = visigothic
                }
            }
		}
        modifier = {
			factor = 1.75
            liege = { culture = roman }
            ROOT = {
                OR = {
                    culture = norman
                    culture = andalusian_arabic
                    culture = outremer
                }
            }
		}
        modifier = {
			factor = 2
            liege = { culture = roman }
            ROOT = { culture = greek }
		}
		# Liege and top liege have differing cultures, and neither culture matches ROOT:
		modifier = {
			factor = 1.4
			liege = {
				top_liege = {
					NOR = {
						culture = PREV
						culture = ROOT
					}
				}
			}
		}
		# Liege and top liege have same culture and are not the same guy:
		modifier = {
			factor = 0.75
			liege = {
				top_liege = {
					NOT = { character = PREV }
					culture = PREV
				}
			}
		}
		# Capital province has same culture as liege:
		modifier = {
			factor = 0.7
			liege = {
				ROOT = {
					capital_scope = {
						culture = PREVPREV
					}
				}
			}
		}
		# At least 1 other demesne province has same culture as liege:
		modifier = {
			factor = 0.8
			liege = {
				ROOT = {
					any_demesne_province = {
						is_capital = no
						culture = PREVPREV
					}
				}
			}
		}
		# At least 2 other demesne provinces have same culture as liege:
		modifier = {
			factor = 0.8
			liege = {
				ROOT = {
					any_demesne_province = {
						count = 2
						is_capital = no
						culture = PREVPREV
					}
				}
			}
		}
		# All other demesne provinces have same culture as liege:
		modifier = {
			factor = 0.8
			liege = {
				ROOT = {
					NOT = {
						any_demesne_province = {
							is_capital = no
							NOT = { culture = PREVPREV }
						}
					}
				}
			}
		}
		# Dumb vassals are especially unlikely to adopt a new culture once over the age of 6:
		modifier = {
			factor = 10
			age > 6
			trait = imbecile
		}
		modifier = {
			factor = 5
			age > 6
			trait = slow
		}
		modifier = {
			factor = 3
			age > 6
			trait = dull
		}
		modifier = {
			factor = 2
			age > 6
			trait = dim
		}
		# Smart vassals are more likely to adopt a new culture (but ability doesn't imply will, so smaller bonus):
		modifier = {
			factor = 0.95
			trait = bright
		}
		modifier = {
			factor = 0.9
			trait = shrewd
		}
		modifier = {
			factor = 0.85
			trait = quick
		}
		modifier = {
			factor = 0.75
			trait = genius
		}
		# Vassals that are on the liege's council are much more likely to adopt the liege's culture:
		modifier = {
			factor = 0.5
			emf_is_voter = yes
		}
		# Vassals without any minor titles or a council position are less likely to adopt the liege's culture:
		modifier = {
			factor = 1.25
			has_job_title = no
			OR = {
				has_minor_title = no
				has_minor_title = title_court_jester
			}
		}
		# Imperial Guards, Courtiers, and Bureaucrats -- once they've come home from the imperial court and become a
		# ruler -- are more likely to convert to their liege's culture if in an empire and their liege is the same
		# culture as the imperial court (or is the emperor):
		#
		# TODO: Modify imperial court mechanic to flag the character with a DSF / save a persistent event target
		# indicating the imperial title for which they served so that we aren't blindly assuming that they're in the same
		# realm still.
		modifier = {
			factor = 0.75
			OR = {
				trait = imperial_guard
				trait = imperial_courtier
				trait = imperial_bureaucrat
			}
			liege = {
				top_liege = {
					real_tier = EMPEROR
					culture = PREV
				}
			}
		}
		# Relative tier to liege:
		modifier = {
			factor = 0.8
			lower_real_tier_than = DUKE
			liege = { real_tier = KING }
		}
		modifier = {
			factor = 0.6
			lower_real_tier_than = DUKE
			liege = { real_tier = EMPEROR }
		}
		modifier = {
			factor = 1.5
			real_tier = KING
		}
		# Excessive relative power to liege:
		modifier = {
			factor = 2.0
			relative_power_to_liege > 1
		}
		modifier = {
			factor = 2.0
			relative_power_to_liege > 0.75
		}
		modifier = {
			factor = 2.0
			relative_power_to_liege > 0.5
		}
		# Civilized vassals will almost never convert to an uncivilized liege's culture (culture conversion to nomads,
		# unless nomadic ourselves, is disabled in the trigger):
		modifier = {
			factor = 7.5
			liege = {
				is_tribal = yes
			}
			OR = {
				is_feudal = yes
				is_republic = yes
				is_theocracy = yes
			}
		}
		modifier = {
			factor = 3.5
			has_horde_culture = no
			liege = { has_horde_culture = yes }
		}
		# Government group affinities (nomads are guaranteed by trigger to have a nomadic liege):
		modifier = {
			factor = 1.2
			is_feudal = yes
			liege = { is_feudal = no }
		}
		modifier = {
			factor = 1.2
			is_republic = yes
			liege = { is_republic = no }
		}
		modifier = {
			factor = 1.2
			is_theocracy = yes
			liege = { is_theocracy = no }
		}
		modifier = {
			factor = 1.2
			is_tribal = yes
			liege = { is_tribal = no }
		}
		# The subjugated are more likely to convert culture. Note that the Subjugated opinion modifier only lasts 5-10
		# years (5 years for having been a different religion at the time of subjugation):
		modifier = {
			factor = 0.5
			OR = {
				has_opinion_modifier = { who = LIEGE modifier = opinion_subjugated }
				has_opinion_modifier = { who = LIEGE modifier = opinion_subjugated_other_rel }
			}
		}
		# Those conquered via holy war that chose to convert truly to the conqueror's religion are more likely to
		# convert for the first 15 years:
		#modifier = {
		#	factor = 0.5
		#	has_flag = emf_relsub_converted_truly
		#	NOT = { had_flag = { flag = emf_relsub_converted_truly days = 5475 } }
		#}
		# Personal relations:
		modifier = { # Royal Marriage / Concubinage
			factor = 0.25
			liege = {
				OR = {
					is_married = ROOT
					is_consort = ROOT
					ROOT = { is_consort = PREV }
				}
			}
		}
		modifier = { # Close relatives
			factor = 0.25
			liege = {
				is_close_relative = ROOT
				# Close relatives include these, so don't stack with Royal Marriage (or at least I think consorts are also
				# included, as certainly spouses are included):
				NOR = {
					is_married = ROOT
					is_consort = ROOT
					ROOT = { is_consort = PREV }
				}
			}
		}
		modifier = { # Same dynasty
			factor = 0.5
			liege = { dynasty = ROOT }
		}
		modifier = { # Friends (Rivals -- indeed all foes -- are completely blocked in the trigger)
			factor = 0.5
			liege = { is_friend = ROOT }
		}
		modifier = { # Lovers
			factor = 0.75
			liege = { is_lover = ROOT }
		}
		modifier = { # Marriage Ties
			factor = 0.75
			liege = {
				any_close_relative = {
					is_married = ROOT
				}
			}
		}
	}

	immediate = {
		# Save prior culture:
		culture_scope = { save_event_target_as = emf_old_culture }
		# Debug logging for calibration:
		if = {
			limit = { has_global_flag = emf_debug_liege_culture_conversion }
			log = "DEBUG: emf_culture.10: AI ruler converting to liege culture:"
			# Don't think [GetID] works on cultures and religions, but let's find out!
			log = " ----> culture: [emf_old_culture.GetName] ([emf_old_culture.GetID])"
			log = " ----> culture_group: [emf_old_culture.GetGroupName]"
			log = " ----> liege/culture: [This.Liege.Culture.GetName] ([This.Liege.Culture.GetID])"
			log = " ----> liege/culture_group: [This.Liege.Culture.GetGroupName]"
			log = " ----> religion: [This.Religion.GetName] ([This.Religion.GetID])"
			log = " ----> government_group: [This.EMF_GetGovernmentGroupName]"
			log = " ----> liege/government_group: [This.Liege.EMF_GetGovernmentGroupName]"
			log = " ----> tier: [This.EMF_GetDebugTier]"
			log = " ----> liege/tier: [This.Liege.EMF_GetDebugTier]"
			log = " ----> primary_title: [This.PrimaryTitle.EMF_GetDebugTitleNameWithDeJureLieges]"
			log = " ----> liege/primary_title: [This.Liege.PrimaryTitle.EMF_GetDebugTitleNameWithDeJureLieges]"
			log = " ----> top_liege/primary_title: [This.TopLiege.PrimaryTitle.EMF_GetDebugTitleNameWithDeJureLieges]"
			export_to_variable = { which = local_age value = age }
			log = " ----> age: [local_age.GetValue]"
			export_to_variable = { which = local_learning value = learning }
			log = " ----> learning: [local_learning.GetValue]"
			export_to_variable = { which = local_relative_power_to_liege value = relative_power_to_liege }
			log = " ----> relative_power_to_liege: [local_relative_power_to_liege.GetValue]"
			if = {
				limit = {
					liege = {
						OR = {
							is_married = ROOT
							is_consort = ROOT
							ROOT = { is_consort = PREV }
						}
					}
				}
				log = " ----> royal_marriage"
			}
			else_if = {
				limit = { liege = { is_close_relative = ROOT } }
				log = " ----> close_relative"
			}
			if = {
				limit = { liege = { dynasty = ROOT } }
				log = " ----> dynasty"
			}
			if = {
				limit = { liege = { is_friend = ROOT } }
				log = " ----> friend"
			}
			if = {
				limit = { liege = { is_lover = ROOT } }
				log = " ----> lover"
			}
			if = {
				limit = { liege = { any_close_relative = { is_married = ROOT } } }
				log = " ----> marriage_ties"
			}
			if = {
				limit = { emf_is_voter = yes }
				log = " ----> voter"
			}
			if = {
				limit = {
					age > 6
					trait = imbecile
				}
				log = " ----> dumb/imbecile"
			}
			if = {
				limit = {
					age > 6
					trait = slow
				}
				log = " ----> dumb/slow"
			}
			if = {
				limit = {
					age > 6
					trait = dull
				}
				log = " ----> dumb/dull"
			}
			if = {
				limit = {
					age > 6
					trait = dim
				}
				log = " ----> dumb/dim"
			}
			if = {
				limit = { trait = bright }
				log = " ----> smart/bright"
			}
			if = {
				limit = { trait = shrewd }
				log = " ----> smart/shrewd"
			}
			if = {
				limit = { trait = quick }
				log = " ----> smart/quick"
			}
			if = {
				limit = { trait = genius }
				log = " ----> smart/genius"
			}
			if = {
				limit = {
					liege = {
						top_liege = {
							NOR = {
								culture = PREV
								culture = ROOT
							}
						}
					}
				}
				log = " ----> liege_and_top_liege_have_different_cultures_from_each_other_and_ROOT"
			}
			if = {
				limit = {
					liege = {
						top_liege = {
							NOT = { character = PREV }
							culture = PREV
						}
					}
				}
				log = " ----> liege_and_top_liege_have_same_culture"
			}
			if = {
				limit = { liege = { ROOT = { capital_scope = { culture = PREVPREV } } } }
				log = " ----> capital_same_as_liege"
			}
			if = {
				limit = {
					liege = {
						ROOT = {
							any_demesne_province = {
								is_capital = no
								culture = PREVPREV
							}
						}
					}
				}
				log = " ----> at_least_1_extra_prov_same_as_liege"
			}
			if = {
				limit = {
					liege = {
						ROOT = {
							any_demesne_province = {
								count = 2
								is_capital = no
								culture = PREVPREV
							}
						}
					}
				}
				log = " ----> at_least_2_extra_prov_same_as_liege"
			}
			if = {
				limit = {
					liege = {
						ROOT = {
							NOT = {
								any_demesne_province = {
									is_capital = no
									NOT = { culture = PREVPREV }
								}
							}
						}
					}
				}
				log = " ----> all_extra_prov_same_as_liege"
			}
			if = {
				limit = { opinion = { who = LIEGE value = 80 } }
				log = " ----> liege_opinion: 80,100"
			}
			else_if = {
				limit = { opinion = { who = LIEGE value = 60 } }
				log = " ----> liege_opinion: 60,79"
			}
			else_if = {
				limit = { opinion = { who = LIEGE value = 40 } }
				log = " ----> liege_opinion: 40,59"
			}
			else_if = {
				limit = { opinion = { who = LIEGE value = 20 } }
				log = " ----> liege_opinion: 20,39"
			}
			else_if = {
				limit = { opinion = { who = LIEGE value = 0 } }
				log = " ----> liege_opinion: 0,19"
			}
			else_if = {
				limit = { opinion = { who = LIEGE value = -10 } }
				log = " ----> liege_opinion: -10,-1"
			}
			else = {
				log = " ----> liege_opinion: -20,-11"
			}
		}
		# Convert own culture:
		liege = { ROOT = { culture = PREV } }
		change_variable = { which = global_rulers_converted_to_liege_culture value = 1 }
		# Convert appropriate non-adult courtiers in our family:
		any_courtier = {
			limit = {
				vassal_of = ROOT
				is_ruler = no
				NOT = { culture = ROOT }
				emf_can_convert_culture = yes
				OR = {
					obedient = ROOT
					AND = {
						is_adult = no
						OR = {
							dynasty = ROOT
							is_close_relative = ROOT
							is_cousin_of = ROOT
							father_even_if_dead = { is_grandchild_of = ROOT }
							mother_even_if_dead = { is_grandchild_of = ROOT }
						}
					}
				}
			}
			culture = ROOT
			change_variable = { which = global_courtiers_converted_to_liege_of_liege_culture value = 1 }
		}
		# Convert non-playable vassal barons of the same prior culture that aren't prisoners or foes:
		any_vassal = {
			limit = {
				real_tier = BARON
				is_playable = no # Patricians convert the normal way
				NOT = { culture = ROOT }
				emf_can_convert_culture = yes
				OR = {
					prisoner = no
					AND = {
						obedient = ROOT
						host = { character = ROOT }
					}
				}
				OR = {
					obedient = ROOT
					AND = {
						culture = event_target:emf_old_culture
						NOT = { is_foe = ROOT }
					}
				}
			}
			culture = ROOT
			change_variable = { which = global_rulers_converted_to_liege_culture value = 1 }
		}
		# Global stats tracking (simple):
		change_variable = { which = global_playable_rulers_converted_to_liege_culture value = 1 }
		if = {
			limit = { real_tier = BARON }
			change_variable = { which = global_baron_playable_rulers_converted_to_liege_culture value = 1 }
		}
		else_if = {
			limit = { real_tier = COUNT }
			change_variable = { which = global_count_playable_rulers_converted_to_liege_culture value = 1 }
		}
		else_if = {
			limit = { real_tier = DUKE }
			change_variable = { which = global_duke_playable_rulers_converted_to_liege_culture value = 1 }
		}
		else = {
			change_variable = { which = global_king_playable_rulers_converted_to_liege_culture value = 1 }
		}
		# Notify liege:
		liege = { character_event = { id = emf_culture.11 } }
	}
}

# emf_culture.11 -- notification event that your vassal, FROM, has converted to your culture [Liege]
character_event = {
	id = emf_culture.11
	desc = emf_culture.11.desc
	picture = GFX_evt_culture_change

	is_triggered_only = yes
	notification = yes

	option = { name = OK }
}

# emf_culture.15 -- inherit the emf_ai_never_convert_culture flag on_birth for one generation
character_event = {
	id = emf_culture.15

	is_triggered_only = yes # on_birth
	hide_window = yes

	trigger = {
		OR = {
			father = {
				is_alive = yes
				ai = yes
				has_flag = emf_ai_never_convert_culture
				NOT = { has_flag = emf_ai_never_convert_culture_2 }
			}
			mother = {
				is_alive = yes
				OR = {
					AND = {
						ai = yes
						has_flag = emf_ai_never_convert_culture
						NOT = { has_flag = emf_ai_never_convert_culture_2 }
					}
					has_flag = emf_ai_never_convert_culture_unborn
				}
			}
		}
	}

	immediate = {
		set_flag = emf_ai_never_convert_culture
		set_flag = emf_ai_never_convert_culture_2
		if = {
			limit = { mother = { has_flag = emf_ai_never_convert_culture_unborn } }
			# We might have twins today, so wait to clear flag:
			mother = { character_event = { id = emf_culture.17 days = 1 } }
		}
	}
}

# emf_culture.16 -- father with emf_ai_never_convert_culture flag dies while wife/consort is pregant
character_event = {
	id = emf_culture.16

	is_triggered_only = yes # on_death
	hide_window = yes

	only_men = yes
	ai = yes
	has_character_flag = emf_ai_never_convert_culture

	trigger = {
		NOT = { has_flag = emf_ai_never_convert_culture_2 }
		OR = {
			any_spouse = {
				is_pregnant = yes
				NOT = { has_flag = emf_ai_never_convert_culture_unborn }
			}
			any_consort = {
				is_pregnant = yes
				NOT = { has_flag = emf_ai_never_convert_culture_unborn }
			}
			any_lover = {
				is_pregnant = yes
				NOT = { has_flag = emf_ai_never_convert_culture_unborn }
				father_of_unborn = { character = ROOT }
			}
		}
	}

	immediate = {
		any_spouse = {
			limit = { is_pregnant = yes }
			set_flag = emf_ai_never_convert_culture_unborn
		}
		any_consort = {
			limit = { is_pregnant = yes }
			set_flag = emf_ai_never_convert_culture_unborn
		}
		any_lover = {
			limit = {
				is_pregnant = yes
				father_of_unborn = { character = ROOT }
			}
			set_flag = emf_ai_never_convert_culture_unborn
		}
	}
}

# emf_culture.17 -- clear emf_ai_never_convert_culture_unborn flag on mother after birth or on_postbirth_stillbirth
character_event = {
	id = emf_culture.17

	is_triggered_only = yes
	hide_window = yes

	only_women = yes
	has_character_flag = emf_ai_never_convert_culture_unborn

	immediate = {
		clr_flag = emf_ai_never_convert_culture_unborn
	}
}

##### FROM HERE ON, THIS STUFF NEEDS TO BE ADAPTED ELSEWHERE AND IS DOOMED IN PRESENT STATE #####

namespace = meneth

#Ruler melting pot event for Norse-Gael
character_event = {
	id = meneth.2
	desc = "meneth.0.desc"
	picture = "GFX_evt_throne_room"

	only_playable = yes
	culture_group = north_germanic

	trigger = {
		NOT = { culture = norsegaelic }
		capital_scope = {
			culture_group = celtic
			religion = ROOT
		}
		NOT = { government = chinese_imperial_government }
	}

	mean_time_to_happen = {
		months = 200
		modifier = {
			factor = 0.5
			real_tier = COUNT
		}
		modifier = {
			factor = 2
			real_tier = DUKE
		}
		modifier = {
			factor = 4
			higher_real_tier_than = DUKE
		}
		modifier = {
			factor = 0.5
			age < 10
		}
		modifier = {
			factor = 1.15
			age >= 10
		}
		modifier = {
			factor = 1.15
			age >= 16
		}
		modifier = {
			factor = 1.15
			age >= 20
		}
		modifier = {
			factor = 1.3
			age >= 30
		}
		modifier = {
			factor = 1.3
			age >= 40
		}
		modifier = {
			factor = 1.5
			age >= 50
		}
		modifier = {
			factor = 2
			age >= 60
		}
		modifier = {
			factor = 0.75
			capital_scope = { NOT = { any_neighbor_province = { culture = ROOT } } }
		}
		modifier = {
			factor = 0.3
			OR = {
				has_game_rule = { name = culture_conversion value = faster_melting_pots }
				has_game_rule = { name = culture_conversion value = faster_melting_pots_and_slower_normal }
			}
		}
	}

	option = {
		name = "meneth.0.a"
		ai_chance = { factor = 100 }
		culture = norsegaelic
		any_spouse = {
			limit = {
				is_ruler = no
				prisoner = no
				culture_group = north_germanic
				NOT = { culture = norsegaelic }
			}
			culture = norsegaelic
		}
		any_child = {
			limit = {
				is_adult = no
				prisoner = no
				OR = {
					is_ruler = no
					tier = BARON
				}
				vassal_of = ROOT
				culture_group = north_germanic
				NOT = { culture = norsegaelic }
			}
			culture = norsegaelic
		}
		any_courtier = {
			limit = {
				dynasty = ROOT
				is_adult = no
				is_ruler = no
				prisoner = no
				culture_group = north_germanic
				NOT = { culture = norsegaelic }
			}
			culture = norsegaelic
		}
	}
	option = {
		name = "meneth.0.b"
		ai_chance = { factor = 0 }
	}
}


# Norse-Gael melting pot (bordering province)
province_event = {
	id = meneth.4
	desc = "EVTDESC55000"
	picture = GFX_evt_carriage

	trigger = {
		culture_group = celtic
		NOT = { culture = norsegaelic }
		owner = { culture_group = north_germanic }
		any_neighbor_province = {
			owner = { culture_group = PREV }
			ROOT = { owner = { culture_group = PREVPREV } }
		}
	}

	mean_time_to_happen = {
		months = 500

		modifier = {
			factor = 0.8
			owner = {
				OR = {
					has_ambition = obj_civilize_province
					any_liege = {
						culture = PREV
						has_ambition = obj_civilize_province
					}
				}
			}
		}
		modifier = {
			factor = 0.75
			port = yes
		}
		modifier = {
			factor = 0.4
			NOT = {
				any_neighbor_province = { culture = ROOT }
			}
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 2 } }
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 3 } }
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 4 } }
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 5 } }
		}
		modifier = {
			factor = 0.75
			owner = { stewardship = 10 }
		}
		modifier = {
			factor = 0.75
			owner = { stewardship = 11 }
		}
		modifier = {
			factor = 0.75
			owner = { stewardship = 12 }
		}
		modifier = {
			factor = 0.75
			owner = { stewardship = 13 }
		}
		modifier = {
			factor = 0.75
			owner = {
				OR = {
					primary_title = { conquest_culture = PREV }
					ROOT = {
						county = { conquest_culture = PREVPREV }
					}
					ROOT = {
						duchy = {
							holder = PREVPREV
							conquest_culture = PREVPREV
						}
					}
					ROOT = {
						kingdom = {
							holder = PREVPREV
							conquest_culture = PREVPREV
						}
					}
					ROOT = {
						empire = {
							holder = PREVPREV
							conquest_culture = PREVPREV
						}
					}
				}
			}
		}
		modifier = {
			factor = 0.3
			OR = {
				has_game_rule = { name = culture_conversion value = faster_melting_pots }
				has_game_rule = { name = culture_conversion value = faster_melting_pots_and_slower_normal }
			}
		}
	}

	option = {
		name = "EVTOPTA55000"
		culture = norsegaelic
		owner = {
			any_vassal = {
				limit = {
					tier = BARON
					capital_holding = { location = { province = ROOT } }
					culture_group = north_germanic
					NOT = { culture = norsegaelic }
				}
				culture = norsegaelic
			}
		}
		save_event_target_as = emf_province
		hidden_tooltip = {
			owner = {
				character_event = { id = emf_ambitions.1 }
				any_liege = { character_event = { id = emf_ambitions.1 } }
			}
		}
	}
}

# Norse-Gael melting pot (port)
province_event = {
	id = meneth.5
	desc = "EVTDESC55001"
	picture = GFX_evt_busy_trading_dock_republic

	trigger = {
		port = yes
		culture_group = celtic
		NOT = { culture = norsegaelic }
		owner = {
			culture_group = north_germanic
			top_liege = {
				culture_group = PREV
				any_realm_province = {
					owner = { same_realm = PREVPREV }
					port = yes
					culture_group = PREV
				}
			}
		}
		NOT = { # Exclude provinces covered by event meneth.4
			any_neighbor_province = {
				culture_group = north_germanic
				owner = { culture_group = north_germanic }
			}
		}
	}

	mean_time_to_happen = {
		months = 600

		modifier = {
			factor = 0.8
			owner = {
				OR = {
					has_ambition = obj_civilize_province
					any_liege = {
						culture = PREV
						has_ambition = obj_civilize_province
					}
				}
			}
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 2 } }
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 3 } }
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 4 } }
		}
		modifier = {
			factor = 1.5
			owner = { NOT = { stewardship = 5 } }
		}
		modifier = {
			factor = 0.75
			owner = { stewardship = 10 }
		}
		modifier = {
			factor = 0.75
			owner = { stewardship = 11}
		}
		modifier = {
			factor = 0.75
			owner = { stewardship = 12 }
		}
		modifier = {
			factor = 0.75
			owner = { stewardship = 13 }
		}
		modifier = {
			factor = 0.3
			OR = {
				has_game_rule = { name = culture_conversion value = faster_melting_pots }
				has_game_rule = { name = culture_conversion value = faster_melting_pots_and_slower_normal }
			}
		}
	}

	option = {
		name = "EVTOPTA55001"
		culture = norsegaelic
		owner = {
			any_vassal = {
				limit = {
					tier = BARON
					capital_holding = { location = { province = ROOT } }
					culture_group = north_germanic
					NOT = { culture = norsegaelic }
				}
				culture = norsegaelic
			}
		}
		save_event_target_as = emf_province
		hidden_tooltip = {
			owner = {
				character_event = { id = emf_ambitions.1 }
				any_liege = { character_event = { id = emf_ambitions.1 } }
			}
		}
	}
}
