
###########################################
#                                         #
# Charlemagne culture conversion events   #
# 										  #
# Unlocked as cultures exist in old gods  #
#                                         #
# ID OC.1-OC.499                          #
#                                         #
###########################################

# Written by Tobias Bodlund

namespace = OC

# Matthew Clohessy
# Unlocked from CM namespace as cultures appear in Old Gods as well

###########################################
# Province conversions                    #
###########################################

# Pictish province converts to Scottish
province_event = {
	id = OC.1
	desc = EVTDESC_CM_1
	picture = GFX_evt_stone_church

	trigger = {
		OR = {
			AND = {
				culture = pictish
				OR = {
					owner = { culture = irish }
					owner = { culture = scottish }
					any_neighbor_province = { culture = scottish }
				}
			}
			AND = {
				culture = irish
				owner = { culture = pictish }
			}
		}
		NOT = {
			owner = { 
				top_liege = { 
					culture = pictish 
					OR = {
						tier = emperor
						num_of_king_titles = 2
					}
				} 
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1200
		modifier = {
			factor = 0.75
			owner = { culture = scottish }
		}
		modifier = {
			factor = 0.5
			year = 850
		}
		modifier = {
			factor = 0.5
			year = 950
		}
		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 = EVTOPTA_CM_1
		culture = scottish
		if = {
			limit = {
				NOT = { has_province_modifier = recent_culture_change }
			}
			add_province_modifier = {
				name = recent_culture_change
				duration = -1
			}
		}
	}
}

# Longobard province converts to Italian
province_event = {
	id = OC.2
	desc = EVTDESC_CM_2
	picture = GFX_evt_stone_church

	trigger = {
        has_game_rule = {
            name = vanilla_italians
            value = yes
        }
		culture = longobard
		OR = {
			owner = { NOT = { culture = longobard } }
			any_neighbor_province = { is_italian_trigger = yes }
		}
		OR = {
			region = custom_italy
			region = custom_sicily
		}
		any_province_holding = {
			NOT = { holding_type = nomad }
		}
	}
	
	mean_time_to_happen = {
		months = 2400
		modifier = {
			factor = 0.3
			owner = { is_italian_trigger = yes }
		}
		modifier = {
			factor = 0.5
			year = 850
		}
		modifier = {
			factor = 0.5
			year = 950
		}
		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 = EVTOPTA_CM_2
		culture = italian
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}

# Old Saxon or Old Frankish or Frisian province converts to Dutch
province_event = {
	id = OC.3
	desc = EVTDESC_CM_3
	picture = GFX_evt_tribal_lands

	trigger = {
		region = custom_frisia
		OR = {
			culture = old_frankish
			culture = frisian
			AND = {
				culture = old_saxon
				has_global_flag = widukind_spawned
				NOT = {
					owner = { 
						top_liege = { 
							culture = old_saxon 
							OR = {
								tier = emperor
								num_of_king_titles = 2
							}
						} 
					}
				}
			}
		}
		NOT = {
			owner = { 
				culture = old_saxon 
				religion_head = { culture = old_saxon }
			}
		}
		OR = {
			owner = { NOT = { culture = ROOT } }
			any_neighbor_province = { culture = dutch }
		}
		any_province_holding = {
			NOT = { holding_type = nomad }
		}
	}
	
	mean_time_to_happen = {
		months = 3600
		modifier = {
			factor = 0.5
			owner = { culture = dutch }
		}
		modifier = {
			factor = 0.5
			year = 850
		}
		modifier = {
			factor = 0.5
			year = 950
		}
		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 = EVTOPTA_CM_3
		culture = dutch
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}

# Old Saxon province converts to German
province_event = {
	id = OC.4
	desc = EVTDESC_CM_4
	picture = GFX_evt_tribal_lands

	trigger = {
		always = no # old_saxon no longer should disappear
	}
	
	mean_time_to_happen = {
		months = 3600
		modifier = {
			factor = 0.5
			owner = { german_cultures_trigger = yes }
		}
		modifier = {
			factor = 0.5
			year = 850
		}
		modifier = {
			factor = 0.5
			year = 950
		}
		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 = EVTOPTA_CM_4
		#this event is disabled anyway. this should be in the main trigger
		#trigger = { german_cultures_trigger = yes }
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}

# Old Frankish province converts to French
province_event = {
	id = OC.5
	desc = EVTDESC_CM_5
	picture = GFX_evt_stone_church

	trigger = {
		year = 800
		culture = old_frankish
		NOR = {
			region = custom_frisia
			region = custom_swabian
			region = custom_austrian
			region = custom_bavarian
			region = custom_colognian
			region = custom_old_saxon
			region = custom_swiss
			region = custom_thuringian
			region = custom_prussian
		}
		owner = {
			OR = {
				culture_group = latin
				culture = old_frankish
			}
		}
		any_province_holding = {
			NOT = { holding_type = nomad }
		}
	}
	
	mean_time_to_happen = {
		months = 1200
		modifier = {
			factor = 0.5
			owner = { culture_group = latin }
		}
		modifier = {
			factor = 0.5
			year = 850
		}
		modifier = {
			factor = 0.5
			year = 950
		}
		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 = EVTOPTA_CM_5
		culture = frankish
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}

# Visigothic province converts to Occitan
province_event = {
	id = OC.6
	desc = EVTDESC_CM_6
	picture = GFX_evt_stone_church

	trigger = {
		culture = visigothic
		NOT = { religion_group = muslim }
		OR = {
			region = custom_aquitaine
			region = custom_burgundy
		}
		any_province_holding = {
			NOT = { holding_type = nomad }
		}
		NOT = {
			owner = { 
				top_liege = { 
					culture = visigothic 
					OR = {
						tier = emperor
						num_of_king_titles = 2
					}
				} 
			}
		}
		NOT = {
			owner = { 
				religion_head = { culture = visigothic }
			}
		}
		year = 850
	}
	
	mean_time_to_happen = {
		months = 3600
		modifier = {
			factor = 0.5
			owner = { culture = occitan }
		}
		modifier = {
			factor = 0.5
			year = 850
		}
		modifier = {
			factor = 0.5
			year = 950
		}
		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 = EVTOPTA_CM_6
		culture = occitan
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}

# Visigothic province converts to Castilian
province_event = {
	id = OC.7
	desc = EVTDESC_CM_7
	picture = GFX_evt_stone_church

	trigger = {
		culture = visigothic
		NOT = { religion_group = muslim }
		OR = {
			region = custom_castillian
			owner = { culture = castillan }
		}
		any_province_holding = {
			NOT = { holding_type = nomad }
		}
		NOT = {
			owner = { 
				top_liege = { 
					culture = visigothic 
					OR = {
						tier = emperor
						num_of_king_titles = 2
					}
				} 
			}
		}
		NOT = {
			owner = { 
				religion_head = { culture = visigothic }
			}
		}
		year = 850
	}
	
	mean_time_to_happen = {
		months = 3600
		modifier = {
			factor = 0.5
			owner = { culture = castillan } 
		}
		modifier = {
			factor = 0.5
			year = 850
		}
		modifier = {
			factor = 0.5
			year = 950
		}
		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 = EVTOPTA_CM_7
		culture = castillan
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}

# Visigothic province converts to Catalan
province_event = {
	id = OC.8
	desc = EVTDESC_CM_8
	picture = GFX_evt_stone_church

	trigger = {
		culture = visigothic
		NOT = { religion_group = muslim }
		OR = {
			region = custom_catalan
			owner = { culture = catalan }
		}
		any_province_holding = {
			NOT = { holding_type = nomad }
		}
		NOT = {
			owner = { 
				top_liege = { 
					culture = visigothic 
					OR = {
						tier = emperor
						num_of_king_titles = 2
					}
				} 
			}
		}
		NOT = {
			owner = { 
				religion_head = { culture = visigothic }
			}
		}
		year = 850
	}
	
	mean_time_to_happen = {
		months = 3600
		modifier = {
			factor = 0.5
			owner = { culture = catalan }
		}
		modifier = {
			factor = 0.5
			year = 850
		}
		modifier = {
			factor = 0.5
			year = 950
		}
		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 = EVTOPTA_CM_8
		culture = catalan
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}

# Visigothic/Suebi province converts to Portuguese
province_event = {
	id = OC.9
	desc = EVTDESC_CM_9
	picture = GFX_evt_stone_church

	trigger = {
		OR = {
			culture = suebi
			culture = visigothic
		}
		NOT = { religion_group = muslim }
		OR = {
			region = custom_portuguese
			owner = { culture = portuguese }
		}
		any_province_holding = {
			NOT = { holding_type = nomad }
		}
		year = 850
		NOT = {
			owner = { 
				top_liege = { 
					culture = visigothic 
					OR = {
						tier = emperor
						num_of_king_titles = 2
					}
				} 
			}
		}
		NOT = {
			owner = { 
				religion_head = { culture = visigothic }
			}
		}
	}
	
	mean_time_to_happen = {
		months = 3600
		modifier = {
			factor = 0.5
			owner = { culture = portuguese }
		}
		modifier = {
			factor = 0.5
			year = 850
		}
		modifier = {
			factor = 0.5
			year = 950
		}
		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 = EVTOPTA_CM_9
		culture = portuguese
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}

# Visigothic/Suebi province converts to Andalusian
province_event = {
	id = OC.10
	desc = EVTDESC_CM_10
	picture = GFX_evt_monk_muslim

	trigger = {
		OR = {
			culture = visigothic
			culture = suebi
		}
		religion_group = muslim
		OR = {
			region = custom_andalusian
			owner = { culture_group = arabic }
		}
		any_province_holding = {
			NOT = { holding_type = nomad }
		}
		NOT = {
			owner = { 
				top_liege = { 
					culture = visigothic 
					OR = {
						tier = emperor
						num_of_king_titles = 2
					}
				} 
			}
		}
		NOT = {
			owner = { 
				religion_head = { culture = visigothic }
			}
		}
		year = 850
	}
	
	mean_time_to_happen = {
		months = 3600
		modifier = {
			factor = 0.5
			owner = { culture_group = arabic }
		}
		modifier = {
			factor = 0.5
			year = 850
		}
		modifier = {
			factor = 0.5
			year = 950
		}
		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 = EVTOPTA_CM_10
		culture = andalusian_arabic
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}

# Bolghar province converts to Bulgarian
province_event = {
	id = OC.11
	desc = EVTDESC_CM_11
	picture = GFX_evt_stone_church

	trigger = {
		culture = bolghar
		OR = {
			owner = { NOT = { culture = bolghar } }
			any_neighbor_province = { culture = bulgarian }
			NOT = {
				religion_head = { culture = THIS }
			}
		}
		OR = {
			region = world_europe_south_east
			region = custom_wallachia
		}
		any_province_holding = {
			NOT = { holding_type = nomad }
		}
	}
	
	mean_time_to_happen = {
		months = 1200
		modifier = {
			factor = 0.3
			owner = { culture_group = altaic }
		}
		modifier = {
			factor = 0.5
			year = 850
		}
		modifier = {
			factor = 0.5
			year = 950
		}
		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 = EVTOPTA_CM_2
		culture = bulgarian
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}

# Longobard province converts to one of Italian cultures
province_event = {
	id = OC.12
	desc = {
		trigger = {
			region = custom_emilian_cultural_area
		}
		text = EVTDESC_ITALY_CC_1
	}
	desc = {
		trigger = {
			region = custom_veneto_cultural_area
		}
		text = EVTDESC_ITALY_CC_2
	}
	desc = {
		trigger = {
			region = custom_ligurian_cultural_area
		}
		text = EVTDESC_ITALY_CC_3
	}
	desc = {
		trigger = {
			region = custom_lombard_cultural_area
		}
		text = EVTDESC_ITALY_CC_4
	}
	desc = {
		trigger = {
			region = custom_umbrian_cultural_area
		}
		text = EVTDESC_ITALY_CC_5
	}
	desc = {
		trigger = {
			region = custom_neapolitan_cultural_area
		}
		text = EVTDESC_ITALY_CC_6
	}
	desc = {
		trigger = {
			region = custom_tuscan_cultural_area
		}
		text = EVTDESC_ITALY_CC_7
	}

	picture = GFX_evt_stone_church

	trigger = {
		culture = longobard
		OR = {
			region = custom_emilian_cultural_area
			region = custom_veneto_cultural_area
			region = custom_ligurian_cultural_area
			region = custom_lombard_cultural_area
			region = custom_umbrian_cultural_area
			region = custom_neapolitan_cultural_area
			region = custom_tuscan_cultural_area
		}
		OR = {
			owner = { NOT = { culture = longobard } }
			any_neighbor_province = { is_italian_trigger = yes }
		}
		any_province_holding = {
			NOT = { holding_type = nomad }
		}
	}
	
	mean_time_to_happen = {
		months = 2400
		modifier = {
			factor = 0.3
			owner = { is_italian_trigger = yes }
		}
		modifier = {
			factor = 0.5
			year = 850
		}
		modifier = {
			factor = 0.5
			year = 950
		}
		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 = EVTOPTA_ITALY_CC_L
		if = {
			limit = { region = custom_emilian_cultural_area }
			culture = emilian
		}
		if = {
			limit = { region = custom_veneto_cultural_area }
			culture = veneto
		}
		if = {
			limit = { region = custom_ligurian_cultural_area }
			culture = ligurian
		}
		if = {
			limit = { region = custom_lombard_cultural_area }
			culture = lombard
		}
		if = {
			limit = { region = custom_umbrian_cultural_area }
			culture = umbrian
		}
		if = {
			limit = { region = custom_neapolitan_cultural_area }
			culture = neapolitan
		}
		if = {
			limit = { region = custom_tuscan_cultural_area }
			culture = tuscan
		}
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}

# Old Frankish province converts to German
province_event = {
	id = OC.13
	desc = EVTDESC_CM_13
	picture = GFX_evt_stone_church

	trigger = {
		year = 800
		NOT = { year = 900 }
		culture = old_frankish
		OR = {
			region = custom_swabian
			region = custom_austrian
			region = custom_bavarian
			region = custom_colognian
			region = custom_old_saxon
			region = custom_swiss
			region = custom_thuringian
			region = custom_prussian
		}
		owner = {
			OR = {
				culture_group = central_germanic
				culture = old_frankish
			}
		}
		any_province_holding = {
			NOT = { holding_type = nomad }
		}
	}
	
	mean_time_to_happen = {
		months = 1200
		modifier = {
			factor = 0.5
			owner = { culture_group = central_germanic }
		}
		modifier = {
			factor = 0.5
			year = 830
		}
		modifier = {
			factor = 0.5
			year = 860
		}
		modifier = {
			factor = 0.5
			year = 890
		}
		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 = EVTOPTA_CM_5
		culture = german
		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}
	}
}
