###################################
#
# THE OLD GODS
# - Culture Conversion Events
#
###################################

# Written by Henrik Eklund

namespace = TOG

# Province culture changes from Norse to Swedish
province_event = {
	id = TOG.2000
	desc = EVTDESC_TOG_2000
	picture = GFX_evt_viking_throneroom_oldgods
	border = GFX_event_normal_frame_diplomacy

	trigger = {
		culture = norse

		OR = {
			region = custom_sweden
			kingdom = { title = k_sweden }
			any_neighbor_province = { culture = swedish }
			owner = { any_liege = { culture = swedish } }
		}

		should_evolve_cultures_trigger = yes
		year >= 950

		# A culturally unified empire shouldn't shatter randomly like this
		owner = {
			top_liege = {
				trigger_if = {
					limit = { culture = norse }

					lower_real_tier_than = EMPEROR
					num_of_king_titles < 2
				}
			}
		}

		NOR = {
			has_global_flag = norse_culture_flipping

			kingdom = {
				OR = {
					title = k_norway
					title = k_denmark
				}
			}

			religion_head = {
				culture = norse
			}
		}
	}

	mean_time_to_happen = {
		years = 150

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

		mult_modifier = {
			factor = 0.75
			year >= 1000
		}

		mult_modifier = {
			factor = 0.75
			year >= 1050
		}

		mult_modifier = {
			factor = 0.75
			year >= 1100
		}

		mult_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_TOG_2000

		trigger = {
			owner = {
				NOT = { culture = swedish }
			}
		}

		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}

		culture = swedish
	}

	option = {
		name = EVTOPTB_TOG_2000

		trigger = {
			owner = {
				culture = swedish
			}
		}

		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}

		culture = swedish
	}
}

# Province culture changes from Norse to Norwegian
province_event = {
	id = TOG.2001
	desc = EVTDESC_TOG_2001
	picture = GFX_evt_viking_throneroom_oldgods
	border = GFX_event_normal_frame_diplomacy

	trigger = {
		culture = norse

		OR = {
			region = custom_norway
			kingdom = { title = k_norway }
			any_neighbor_province = { culture = norwegian }
			owner = { any_liege = { culture = norwegian } }
		}

		should_evolve_cultures_trigger = yes
		year >= 950

		# A culturally unified empire shouldn't shatter randomly like this
		owner = {
			top_liege = {
				trigger_if = {
					limit = { culture = norse }

					lower_real_tier_than = EMPEROR
					num_of_king_titles < 2
				}
			}
		}

		NOR = {
			has_global_flag = norse_culture_flipping

			kingdom = {
				OR = {
					title = k_sweden
					title = k_denmark
				}
			}

			religion_head = {
				culture = norse
			}
		}
	}

	mean_time_to_happen = {
		years = 150

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

		mult_modifier = {
			factor = 0.75
			year >= 1000
		}

		mult_modifier = {
			factor = 0.75
			year >= 1050
		}

		mult_modifier = {
			factor = 0.75
			year >= 1100
		}

		mult_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_TOG_2001

		trigger = {
			owner = {
				NOT = { culture = norwegian }
			}
		}

		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}

		culture = norwegian
	}

	option = {
		name = EVTOPTB_TOG_2001

		trigger = {
			owner = { culture = norwegian }
		}

		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}

		culture = norwegian
	}
}

# Province culture changes from Norse to Danish
province_event = {
	id = TOG.2002
	desc = EVTDESC_TOG_2002
	picture = GFX_evt_viking_throneroom_oldgods
	border = GFX_event_normal_frame_diplomacy

	trigger = {
		culture = norse

		OR = {
			region = custom_denmark
			kingdom = { title = k_denmark }
			any_neighbor_province = { culture = danish }
			owner = { any_liege = { culture = danish } }
		}

		should_evolve_cultures_trigger = yes
		year >= 950

		# A culturally unified empire shouldn't shatter randomly like this
		owner = {
			top_liege = {
				trigger_if = {
					limit = { culture = norse }

					lower_real_tier_than = EMPEROR
					num_of_king_titles < 2
				}
			}
		}

		NOR = {
			has_global_flag = norse_culture_flipping

			kingdom = {
				OR = {
					title = k_sweden
					title = k_norway
				}
			}

			religion_head = {
				culture = norse
			}
		}
	}

	mean_time_to_happen = {
		years = 150

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

		mult_modifier = {
			factor = 0.75
			year >= 1000
		}

		mult_modifier = {
			factor = 0.75
			year >= 1050
		}

		mult_modifier = {
			factor = 0.75
			year >= 1100
		}

		mult_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_TOG_2002

		trigger = {
			owner = {
				NOT = { culture = danish }
			}
		}

		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}

		culture = danish
	}

	option = {
		name = EVTOPTB_TOG_2002

		trigger = {
			owner = { culture = danish }
		}

		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}

		culture = danish
	}
}

# Province adopts Norman culture - Disabled in CK2Plus
# province_event = {
# 	id = TOG.2003
# 	desc = EVTDESC_TOG_2003
# 	picture = GFX_evt_viking_throneroom_oldgods
# 	border = GFX_event_normal_frame_diplomacy
#
# 	trigger = {
# 		OR = {
# 			culture = french
# 			culture = breton
# 			culture = occitan
# 		}
#
# 		owner = {
# 			OR = {
# 				culture = norse
# 				culture = norman
# 			}
# 		}
#
# 		year < 1150
# 		should_evolve_cultures_trigger = yes
# 	}
#
# 	mean_time_to_happen = {
# 		years = 50
#
# 		mult_modifier = {
# 			factor = 0.5
# 			any_neighbor_province = { culture = norman }
# 		}
#
# 		mult_modifier = {
# 			factor = 0.75
# 			year = 1000
# 		}
#
# 		mult_modifier = {
# 			factor = 0.75
# 			year = 1050
# 		}
#
# 		mult_modifier = {
# 			factor = 0.75
# 			year = 1100
# 		}
#
# 		mult_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_TOG_2003
#
# 		trigger = {
# 			owner = {
# 				NOT = { culture = norman }
# 			}
# 		}
# 		add_province_modifier = {
# 			name = recent_culture_change
# 			duration = -1
# 		}
# 		culture = norman
# 	}
#
# 	option = {
# 		name = EVTOPTB_TOG_2003
#
# 		trigger = {
# 			owner = { culture = norman }
# 		}
# 		add_province_modifier = {
# 			name = recent_culture_change
# 			duration = -1
# 		}
# 		culture = norman
# 	}
# }

# Provinces can now flip to Norse culture
# CleanSlate: No longer needed
# character_event = {
# 	id = TOG.2004
#
# 	hide_window = yes
#
# 	only_playable = yes
#
# 	trigger = {
# 		owns = event_target:pulse_province
#
# 		OR = {
# 			year >= 1150
# 			non_historical_culture_names_in_alt_start_trigger = yes
# 		}
#
# 		NOT = { has_global_flag = norse_culture_flipping }
# 	}
#
# 	mean_time_to_happen = {
# 		days = 1
# 	}
#
# 	immediate = {
# 		set_global_flag = norse_culture_flipping
# 	}
# }

# Province culture changes from Norse to Icelandic
province_event = {
	id = TOG.2005
	desc = EVTDESC_TOG_2005
	picture = GFX_evt_viking_throneroom_oldgods
	border = GFX_event_normal_frame_diplomacy

	trigger = {
		culture = norse
		region = custom_north_sea
		should_evolve_cultures_trigger = yes
		year >= 950

		OR = {
			duchy = { title = d_iceland }
			any_neighbor_province = { culture = icelandic }
			owner = { any_liege = { culture = icelandic } }
		}

		NOR = {
			has_global_flag = norse_culture_flipping

			kingdom = {
				OR = {
					title = k_denmark
					title = k_sweden
					title = k_norway
				}
			}

			owner = { # A culturally unified empire shouldn't shatter randomly like this
				top_liege = {
					culture = norse
					real_tier = EMPEROR
				}
			}
		}
	}

	mean_time_to_happen = {
		years = 150

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

		mult_modifier = {
			factor = 0.75
			year >= 1000
		}

		mult_modifier = {
			factor = 0.75
			year >= 1050
		}

		mult_modifier = {
			factor = 0.75
			year >= 1100
		}

		mult_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_TOG_2005

		trigger = {
			owner = {
				NOT = { culture = icelandic }
			}
		}

		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}

		culture = icelandic
	}

	option = {
		name = EVTOPTB_TOG_2005

		trigger = {
			owner = { culture = icelandic }
		}

		add_province_modifier = {
			name = recent_culture_change
			duration = -1
		}

		culture = icelandic
	}
}