###################################
#
# 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 = {
		year = 950
		culture = norse
		NOT = {	has_global_flag = norse_culture_flipping }
		NOT = {
			owner = { 
				top_liege = { 
					culture = norse 
					OR = {
						tier = emperor
						num_of_king_titles = 2
					}
				} 
			}
		}
		NOT = {
			owner = { 
				religion_head = { culture = norse }
			}
		}
		OR = {
			region = custom_sweden
			kingdom = { title = k_sweden }
			any_neighbor_province = { culture = swedish }
			owner = { any_liege = { culture = swedish } }
		}
		NOT = {
			kingdom = { title = k_norway }
			kingdom = { title = k_denmark }
			owner = { # A culturally unified empire shouldn't shatter randomly like this
				top_liege = {
					culture = norse
					tier = emperor
				}
			}
		}
	}

	mean_time_to_happen = {
		months = 1800
		modifier = {
			factor = 0.5
			any_neighbor_province = { culture = swedish }
		}
		modifier = {
			factor = 0.75
			year = 1000
		}
		modifier = {
			factor = 0.75
			year = 1050
		}
		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
				}
			}
		}
		modifier = {
			factor = 0.75
			year = 1100
		}
	}

	option = {
		name = EVTOPTA_TOG_2000
		trigger = {
			NOT = {
				owner = { 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 = {
		year = 950
		culture = norse
		NOT = {	has_global_flag = norse_culture_flipping }
		NOT = {
			owner = { 
				top_liege = { 
					culture = norse 
					OR = {
						tier = emperor
						num_of_king_titles = 2
					}
				} 
			}
		}
		NOT = {
			owner = { 
				religion_head = { culture = norse }
			}
		}
		OR = {
			region = custom_norway
			kingdom = { title = k_norway }
			any_neighbor_province = { culture = norwegian }
			owner = { any_liege = { culture = norwegian } }
		}
		NOT = {
			kingdom = { title = k_sweden }
			kingdom = { title = k_denmark }
			owner = { # A culturally unified empire shouldn't shatter randomly like this
				top_liege = {
					culture = norse
					tier = emperor
				}
			}
		}
	}

	mean_time_to_happen = {
		months = 1800
		modifier = {
			factor = 0.5
			any_neighbor_province = { culture = norwegian }
		}
		modifier = {
			factor = 0.75
			year = 1000
		}
		modifier = {
			factor = 0.75
			year = 1050
		}
		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
				}
			}
		}
		modifier = {
			factor = 0.75
			year = 1100
		}
	}

	option = {
		name = EVTOPTA_TOG_2001
		trigger = {
			NOT = {
				owner = { 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 = {
		year = 950
		culture = norse
		NOT = {	has_global_flag = norse_culture_flipping }
		NOT = {
			owner = { 
				top_liege = { 
					culture = norse 
					OR = {
						tier = emperor
						num_of_king_titles = 2
					}
				} 
			}
		}
		NOT = {
			owner = { 
				religion_head = { culture = norse }
			}
		}
		OR = {
			region = custom_denmark
			kingdom = { title = k_denmark }
			any_neighbor_province = { culture = danish }
			owner = { any_liege = { culture = danish } }
		}
		NOT = {
			kingdom = { title = k_sweden }
			kingdom = { title = k_norway }
			owner = { # A culturally unified empire shouldn't shatter randomly like this
				top_liege = {
					culture = norse
					tier = emperor
				}
			}
		}
	}

	mean_time_to_happen = {
		months = 1800
		modifier = {
			factor = 0.5
			any_neighbor_province = { culture = danish }
		}
		modifier = {
			factor = 0.75
			year = 1000
		}
		modifier = {
			factor = 0.75
			year = 1050
		}
		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
				}
			}
		}
		modifier = {
			factor = 0.75
			year = 1100
		}
	}

	option = {
		name = EVTOPTA_TOG_2002
		trigger = {
			NOT = {
				owner = { 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
	}
}

# Provinces can now flip to Norse culture
character_event = {
	id = TOG.2004
	hide_window = yes

	trigger = {
		year = 1150
		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 = {
		year = 950
		culture = norse
		region = custom_north_sea
		NOT = {	has_global_flag = norse_culture_flipping }
		OR = {
			duchy = { title = d_iceland }
			any_neighbor_province = { culture = icelandic }
			owner = { any_liege = { culture = icelandic } }
		}
		NOR = {
			kingdom = { title = k_denmark }
			kingdom = { title = k_sweden }
			kingdom = { title = k_norway }
			owner = { # A culturally unified empire shouldn't shatter randomly like this
				top_liege = {
					culture = norse
					tier = emperor
				}
			}
		}
	}

	mean_time_to_happen = {
		months = 1800
		modifier = {
			factor = 0.5
			any_neighbor_province = { culture = icelandic }
		}
		modifier = {
			factor = 0.75
			year = 1000
		}
		modifier = {
			factor = 0.75
			year = 1050
		}
		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
				}
			}
		}
		modifier = {
			factor = 0.75
			year = 1100
		}
	}

	option = {
		name = EVTOPTA_TOG_2005
		trigger = {
			NOT = {
				owner = { 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
	}
}

