﻿#is_standard_legend_spreading_courtier
#has_access_to_legitimizing_seeds
#has_legend_chapter_trigger - checks if you own a legend

is_standard_legend_spreading_courtier = {
	this != root
	this != root.promoted_legend.legend_protagonist
	NOT = { is_spouse_of = root }
	NOT = { is_child_of = root }
	is_available_ai_adult = yes	
}

locale_valid_for_legendary_buildings = {
	scope:location ?= {
		OR = {
			province_owner = root
			province_owner.top_liege = root
		}
		has_special_building_slot = no
	}

}

valid_for_legendary_integration_k = {
	save_temporary_scope_as = title_to_check
	OR = {
		custom_tooltip = {
			text = control_the_entirity_of_title_tt
			AND = {
				de_jure_drift_progress = {
					target = root.primary_title
					value > 0
				}
				root = { completely_controls = scope:title_to_check }
			}
		}
		holder = root
	}
	custom_tooltip = {
		text = not_already_de_jure_your_title_tt
		NOR = {
			this = root.primary_title
			root.primary_title = {
				is_de_jure_liege_or_above_target = scope:title_to_check
			}
		}
	}
}

valid_for_legendary_integration_d = {
	OR = {
		de_jure_drift_progress = {
			target = root.primary_title
			value > 0
		}
		kingdom ?= {
			de_jure_drift_progress = {
				target = root.primary_title
				value > 0
			}
		}
		holder = root
	}
	NOR = {
		kingdom ?= root.primary_title
		empire ?= root.primary_title
	}
}

has_legend_chapter_trigger = {
	has_dlc_feature = legends
	exists = promoted_legend
	promoted_legend.legend_owner = root
	promoted_legend = {
		has_legend_chapter = $CHAPTER$
	}
}

has_legend_chapter_winner_trigger = {
	has_dlc_feature = legends
	exists = promoted_legend
	promoted_legend.legend_owner = scope:winner
	promoted_legend = {
		has_legend_chapter = $CHAPTER$
	}
}

has_any_point_of_interest_flag = {
	OR = {
		has_building_with_flag = {
			flag = travel_point_of_interest_martial
		}
		has_building_with_flag = {
			flag = travel_point_of_interest_martial_minor
		}
		has_building_with_flag = {
			flag = travel_point_of_interest_religious
		}
		has_building_with_flag = {
			flag = travel_point_of_interest_diplomatic
		}
		has_building_with_flag = {
			flag = travel_point_of_interest_wonder
		}
		has_building_with_flag = {
			flag = travel_point_of_interest_economic
		}
		has_building_with_flag = {
			flag = travel_point_of_interest_learning
		}
		has_building_with_flag = {
			flag = travel_point_of_interest_natural_feature
		}
		has_building_with_flag = {
			flag = travel_point_of_interest_stress_relief
		}
	}
}

