﻿namespace = rhm_setup

# Game Start - Assign ethos aspirations to all houses based on culture heritage
rhm_setup.0001 = {
	scope = none
	hidden = yes

	immediate = {
		# Process all houses through their heads
		every_living_character = {
			limit = {
				is_house_head = yes
				exists = house
				house = {
					NOT = { has_variable = rhm_ethos_assigned }
				}
			}

			house = {
				# Mark as processed to avoid duplicates
				set_variable = {
					name = rhm_ethos_assigned
					value = yes
				}

				# Assign ethos aspiration based on house head's culture heritage

				# MARTIAL - Norse, Mongols, Turks, Steppe peoples
				if = {
					limit = {
						house_head = {
							culture = {
								OR = {
									has_cultural_pillar = heritage_north_germanic
									has_cultural_pillar = heritage_mongolic
									has_cultural_pillar = heritage_turkic
								}
							}
						}
					}
					set_house_aspiration = {
						type = rhm_ethos_martial
						level = 1
					}
				}
				# SCHOLARLY - Byzantine, Arabic, Persian, Indian
				else_if = {
					limit = {
						house_head = {
							culture = {
								OR = {
									has_cultural_pillar = heritage_byzantine
									has_cultural_pillar = heritage_arabic
									has_cultural_pillar = heritage_iranian
									has_cultural_pillar = heritage_dravidian
									has_cultural_pillar = heritage_indo_aryan
								}
							}
						}
					}
					set_house_aspiration = {
						type = rhm_ethos_scholarly
						level = 1
					}
				}
				# PIOUS - Latin, Iberian, Israelite
				else_if = {
					limit = {
						house_head = {
							culture = {
								OR = {
									has_cultural_pillar = heritage_latin
									has_cultural_pillar = heritage_iberian
									has_cultural_pillar = heritage_israelite
								}
							}
						}
					}
					set_house_aspiration = {
						type = rhm_ethos_pious
						level = 1
					}
				}
				# LEGACY - Frankish, German, Celtic
				else_if = {
					limit = {
						house_head = {
							culture = {
								OR = {
									has_cultural_pillar = heritage_frankish
									has_cultural_pillar = heritage_central_germanic
									has_cultural_pillar = heritage_west_germanic
									has_cultural_pillar = heritage_goidelic
									has_cultural_pillar = heritage_brythonic
								}
							}
						}
					}
					set_house_aspiration = {
						type = rhm_ethos_legacy
						level = 1
					}
				}
				# VENGEFUL - Slavic peoples
				else_if = {
					limit = {
						house_head = {
							culture = {
								OR = {
									has_cultural_pillar = heritage_south_slavic
									has_cultural_pillar = heritage_east_slavic
									has_cultural_pillar = heritage_west_slavic
								}
							}
						}
					}
					set_house_aspiration = {
						type = rhm_ethos_vengeful
						level = 1
					}
				}
				# CUNNING - Default for unspecified cultures
				else = {
					set_house_aspiration = {
						type = rhm_ethos_cunning
						level = 1
					}
				}
			}
		}
	}
}
