﻿### Happens when a culture is created through hybridization or divergence
# Root = The new culture
# scope:founder = The founder of the new culture
on_culture_created = {
	### previously set scopes:
	# parent_culture_1
	# parent_culture_2
	on_actions = {
		NCCN_rename_hybrid_culture_after_creation_on_action
	}
}

# set_culture_name = {
#	noun = dynamic description
#	collective_noun = dynamic description
#	prefix = dynamic description
# }

NCCN_rename_hybrid_culture_after_creation_on_action = {
	trigger = {
		scope:founder = { is_ai = yes }
		is_hybrid_culture = yes
		NCCN_hybrid_culture_has_unique_name_trigger = no
	}
	effect = {
		# rename after capital county
		if = {
			# check for duplicate name
			limit = {
				NOT = {
					scope:founder.capital_county = {
						is_target_in_global_variable_list = {
							name = global_hybridization_capital_list
							target = this
						}
					}
				}
			}
			set_culture_name = {
				noun = NEW_HYBRID_NAME_FORMAT_0
				collective_noun = NEW_HYBRID_COLLECTIVE_NOUN_FORMAT_0
				prefix = NEW_HYBRID_PREFIX_FORMAT_0
			}
			scope:founder = {
				add_to_global_variable_list = {
					name = global_hybridization_capital_list
					target = capital_county
				}
			}
		}
		# rename after capital duchy
		else_if = {
			# check for duplicate name
			limit = {
				NOT = {
					scope:founder.capital_county.duchy = {
						is_target_in_global_variable_list = {
							name = global_hybridization_capital_list
							target = this
						}
					}
				}
			}
			set_culture_name = {
				noun = NEW_HYBRID_NAME_FORMAT_1
				collective_noun = NEW_HYBRID_COLLECTIVE_NOUN_FORMAT_1
				prefix = NEW_HYBRID_PREFIX_FORMAT_1
			}
			scope:founder = {
				add_to_global_variable_list = {
					name = global_hybridization_capital_list
					target = capital_county.duchy
				}
			}
		}
		else = {
			#debug_log = "new hybrid culture not renamed"
		}
	}
}