﻿absenteelord_effect = {
	if = {
		limit = {
			NOR = {
			has_government = landless_adventurer_government
			has_government = nomad_government
			has_government = herder_government
			has_government = republic_government
			has_government = theocracy_government
			has_government = steppe_admin_government
			has_trait = lifestyle_absenteelord
			}
			highest_held_title_tier >= tier_county
		}
		absenteelord_set_up_effects = yes
	}
	else_if = {
		limit = {
			has_trait = lifestyle_absenteelord
			has_trait_xp = {
				trait = lifestyle_absenteelord
				value < 100
			}
			highest_held_title_tier >= tier_county
		}
		absenteelord_xp_effects = yes
	}
}

absenteelord_set_up_effects = {
	if = {
		limit = { is_ai = yes }
		add_trait = absenteelordai
	}
	else = {
		add_trait = lifestyle_absenteelord
	}
}

absenteelord_xp_effects = {
	if = {
		limit = {
			OR = {
				has_trait = lifestyle_surveyor
				has_trait = overseer
				has_trait = administrator
				has_trait = diplomat
				#any_held_title = { count <= 5 }
			}
		}
		add_trait_xp = {
			trait = lifestyle_absenteelord
			value = {
				integer_range = {
					min = -2
					max = 4
				}
			}
		}
	}
	else = {
		add_trait_xp = {
			trait = lifestyle_absenteelord
			value = {
				integer_range = {
					min = -1
					max = 4
				}
			}
		}
	}
}

absenteelorddecade_effect = {
	if = {
		limit = {
			is_available_vt = yes
		}
		add_trait_xp = {
			trait = lifestyle_absenteelord
			value = {
				integer_range = {
					min = -15
					max = -5
				}
			}
		}
	}
}

absenteelordcomplete_effect = {
	if = {
		limit = {
			is_ai = no
			has_trait = lifestyle_absenteelord
		}
		add_trait_xp = {
			trait = lifestyle_absenteelord
			value = {
				integer_range = {
					min = -10
					max = -2
				}
			}
		}
	}
	if = {
		limit = {
			has_trait = absenteelordai
		}
		remove_trait = absenteelordai
	}
}

absenteelordcleaner_effect = {
	if = {
		limit = {
			OR = {
				has_government = landless_adventurer_government
				has_government = nomad_government
				has_government = herder_government
				has_government = republic_government
				has_government = theocracy_government
				has_government = steppe_admin_government
				highest_held_title_tier < tier_county
				is_landed = no
			}
			has_trait = lifestyle_absenteelordai
		}
		remove_trait = lifestyle_absenteelordai
	}
}
