﻿

gptm_feudal_domicile_set_up_effect = {
	if = {
		limit = { is_domicile_type = feudal_domicile }
		# Intentionally one level lower than what you can get
		if = {
			limit = {
				NOT = { has_domicile_building_or_higher = feudal_domicile_main_02 }
				owner.culture ?= { has_innovation = innovation_city_planning }
				owner.highest_held_title_tier >= 3
			}
			add_domicile_building = feudal_domicile_main_02
		}
		if = {
			limit = {
				has_domicile_building = feudal_domicile_main_02
				NOT = { has_domicile_building_or_higher = feudal_domicile_main_03 }
				owner.culture ?= { has_innovation = innovation_manorialism }
				owner.highest_held_title_tier >= 4
			}
			add_domicile_building = feudal_domicile_main_03
		}
		if = {
			limit = {
				has_domicile_building = feudal_domicile_main_03
				NOT = { has_domicile_building_or_higher = feudal_domicile_main_04 }
				owner.culture ?= { has_innovation = innovation_development_03 }
				owner.highest_held_title_tier >= 5
			}
			add_domicile_building = feudal_domicile_main_04
		}
	}
}

gptm_clan_domicile_set_up_effect = {
	if = {
		limit = { is_domicile_type = clan_domicile }
		# Intentionally one level lower than what you can get
		if = {
			limit = {
				NOT = { has_domicile_building_or_higher = clan_domicile_main_02 }
				owner.culture ?= { has_innovation = innovation_city_planning }
				owner.highest_held_title_tier >= 3
			}
			add_domicile_building = clan_domicile_main_02
		}
		if = {
			limit = {
				has_domicile_building = clan_domicile_main_02
				NOT = { has_domicile_building_or_higher = clan_domicile_main_03 }
				owner.culture ?= { has_innovation = innovation_manorialism }
				owner.highest_held_title_tier >= 4
			}
			add_domicile_building = clan_domicile_main_03
		}
		if = {
			limit = {
				has_domicile_building = clan_domicile_main_03
				NOT = { has_domicile_building_or_higher = clan_domicile_main_04 }
				owner.culture ?= { has_innovation = innovation_development_03 }
				owner.highest_held_title_tier >= 5
			}
			add_domicile_building = clan_domicile_main_04
		}
	}
}

gptm_tribal_camp_set_up_effect = {
	if = {
		limit = { is_domicile_type = tribal_camp }
		# Intentionally one level lower than what you can get
		if = {
			limit = {
				NOT = { has_domicile_building_or_higher = tribal_camp_main_02 }
				owner.highest_held_title_tier >= 3
			}
			add_domicile_building = tribal_camp_main_02
		}
		if = {
			limit = {
				has_domicile_building = tribal_camp_main_02
				NOT = { has_domicile_building_or_higher = tribal_camp_main_03 }
				owner.highest_held_title_tier >= 4
			}
			add_domicile_building = tribal_camp_main_03
		}
		if = {
			limit = {
				has_domicile_building = tribal_camp_main_03
				NOT = { has_domicile_building_or_higher = tribal_camp_main_04 }
				owner.highest_held_title_tier >= 5
			}
			add_domicile_building = tribal_camp_main_04
		}
	}
}