﻿#Taken from WtWSMS-CK3; used with permission
yearly_global_pulse = {
	on_actions = {
		delay = { days = { 1 365 } }
		liguistic_shift
		# delay = { days = { 1 365 } }
		# heritage_shift
	}
}

liguistic_shift = {
	effect = {
		if = { #Gate event to prevent overly agressive firing; no more than one every 10 years (see the event file)
			limit = { NOT = { has_global_variable = recent_language_shift } }
			every_culture_global = {
				limit = {
					is_a_living_culture_trigger = yes
					OR = {
						has_cultural_pillar = language_brythonek
						has_cultural_pillar = language_kymraeg
						has_cultural_pillar = language_anglic #Middle English shift
					}
				}
				save_scope_as = shift_culture
				
				#Brythonic to Cornish (Kernowek) and Breton (Brezhoneg)
				if = {
					limit = { has_cultural_pillar = language_brythonek }
					generic_shift_culture_event_effect = {
						EVENT_ID = ce_bp_heritage_linguistic_drift.0001
						HERITAGE_OR_LANGUAGE = language
						SHIFT_START_YEAR = 800
						SHIFT_PERIOD_YEARS = 40
						UNITED_POLITIY_PREVENTS_SHIFT = no
					}
				}
				#Kymraeg to Cumbric & Welsh
				if = {
					limit = { has_cultural_pillar = language_kymraeg }
					generic_shift_culture_event_effect = {
						EVENT_ID = ce_bp_heritage_linguistic_drift.0001
						HERITAGE_OR_LANGUAGE = language
						SHIFT_START_YEAR = 800
						SHIFT_PERIOD_YEARS = 40
						UNITED_POLITIY_PREVENTS_SHIFT = no
					}
				}
				#Anglic language (even Frisian) shift only if dominated by Frenchmen of some sort...
				if = {
					limit = {
						has_cultural_pillar = language_anglic
						OR = {
							scope:shift_culture = { the_culture_is_dominated_by_another_heritage_trigger = { RULER_HERITAGE = heritage_frankish } }
							scope:shift_culture = culture:english
						}
					}
					generic_shift_culture_event_effect = {
						EVENT_ID = ce_bp_heritage_linguistic_drift.0001
						HERITAGE_OR_LANGUAGE = language
						SHIFT_START_YEAR = 1050
						SHIFT_PERIOD_YEARS = 25
						UNITED_POLITIY_PREVENTS_SHIFT = no
					}
				}
			}
		}
	}
}

# heritage_shift = {
# 	effect = {
# 		if = { #Gate event to prevent overly agressive firing; no more than one every 10 years (see the event file)
# 			limit = { NOT = { has_global_variable = recent_heritage_shift } }
# 			every_culture_global = {
# 				limit = {
# 					is_a_living_culture_trigger = yes
# 					OR = {
# 						AND = {
# 							has_cultural_pillar = heritage_iranian
# 							this = culture:alan
# 						}
# 					}
# 				}
# 				save_scope_as = shift_culture
				
# 				if = { #Alan to Caucasian, when Alan is buried next to Caucasian...
# 					limit = {
# 						this = culture:alan
# 						this = {
# 							any_culture_county = {
# 								percent >= 0.75
# 								any_neighboring_county = {
# 									OR = {
# 										this.culture = { has_cultural_pillar = heritage_caucasian }
# 										this.culture = culture:alan
# 									}
# 								}
# 							}
# 						}
# 					}
# 					generic_shift_culture_event_effect = {
# 						EVENT_ID = ce_bp_heritage_linguistic_drift.0101
# 						HERITAGE_OR_LANGUAGE = heritage
# 						SHIFT_START_YEAR = 1000
# 						SHIFT_PERIOD_YEARS = 25
# 						UNITED_POLITIY_PREVENTS_SHIFT = no
# 					}
# 				}
# 			}
# 		}
# 	}
# }
