﻿olympia_possible_cull_trigger = {

	has_trait = acotw_obscured										#Redundant safety check
	is_adult = yes
	
	NOR = {                                                      
		is_ruler = yes														#Counts and higher are all kept safe
		is_landless_ruler = yes												#Landless rulers are safe too, also covers heads of houses
		is_house_head = yes	
		
		#794 to 840
		has_character_flag = acotw_cull_immunity							#These are characters that are always immune flag set at birth
		
		AND = {
			is_knight = yes
			health >= 3.0
			prowess >= 15
		}
		
		AND = {
			health >= 3.0													#Must be Fine Health or Higher
			OR = {
				has_any_court_position = yes								#Anyone with a court position is safe
				is_councillor = yes											#Councillors are all kept safe

				is_pregnant = yes											#Pregnant women are safe
				has_variable = gone_adventuring								#Adventurers safe
				exists = inspiration										#Keep those inspirations alive

				diplomacy >= 20
				martial >= 20
				stewardship >= 20
				intrigue >= 20
				learning >= 20
				prowess >= 20
				
				AND = {
					age <= 35
					OR = {
						num_of_good_genetic_traits > 0
						num_of_bad_genetic_traits > 0
					}
				}
				
				any_close_family_member = {									#Anyone with a close duchy-ruler relative is guaranteed safe
					OR = {
						any_held_title = { tier >= tier_duchy }
						is_landless_ruler = yes
					}
				}
				any_consort = {												#Anyone spouse/concubines with a landed Duke+ ruler are safe
					OR = {
						any_held_title = { tier >= tier_duchy }
						is_landless_ruler = yes
					}
				}
				any_claim = {		
					tier >= tier_duchy
				}
			}
		}
		
		#Mod support, check zzzzz_olympia_actow_mod_support.txt
		acotw_has_important_modded_trait_or_quality = yes
	}
}

olympia_early_game_possible_cull_trigger = {

	is_adult = yes
	
	NOR = {                                                      
		is_ruler = yes														#Counts and higher are all kept safe
		is_landless_ruler = yes												#Landless rulers are safe too
		is_house_head = yes					
		
		has_character_flag = acotw_cull_immunity							#These are characters that are always immune flag set at birth
		
		AND = {
			is_knight = yes
			health >= 3.0
			prowess >= 10
		}
		
		OR = {
			has_any_court_position = yes								#Anyone with a court position is safe
			is_councillor = yes											#Councillors are all kept safe

			any_child = { is_alive = yes }								#Protect families early on
			any_parent = { even_if_dead = yes }							#No orphans to start, preserve established families on game start

			has_variable = gone_adventuring								#Adventurers safe

			diplomacy >= 15
			martial >= 15
			stewardship >= 15
			intrigue >= 15
			learning >= 15
			prowess >= 15
			
			AND = {
				age <= 35
				OR = {
					num_of_good_genetic_traits > 0
					num_of_bad_genetic_traits > 0
				}
			}
			
			any_close_family_member = {									#Anyone with a close duchy-ruler relative is guaranteed safe
				OR = {
					any_held_title = { tier >= tier_county }
					is_landless_ruler = yes
				}
			}
			any_consort = {												#Anyone spouse/concubines with a landed Duke+ ruler are safe
				OR = {
					any_held_title = { tier >= tier_county }
					is_landless_ruler = yes
				}
			}
			any_claim = {		
				tier >= tier_county
			}
		}
		
		#Mod support, check zzzzz_olympia_actow_mod_support.txt
		acotw_has_important_modded_trait_or_quality = yes
	}
}

olympia_early_game_possible_extreme_cull_trigger = {

	is_adult = yes
	
	NOR = {                                                      
		is_ruler = yes													#Counts and higher are all kept safe
		is_landless_ruler = yes											#Landless rulers are safe too, also covers heads of houses

		has_character_flag = acotw_cull_immunity						#These are characters that are always immune flag set at birth
		
		OR = {
			has_variable = gone_adventuring								#Adventurers safe
			
			any_child = { is_alive = yes }								#Protect families early on
			any_parent = { even_if_dead = yes }							#No orphans to start, preserve established families on game start
			
			any_close_family_member = {									#Anyone with a close duchy-ruler relative is guaranteed safe
				OR = {
					any_held_title = { tier >= tier_barony }
					is_landless_ruler = yes
				}
			}
			any_consort = {												#Anyone spouse/concubines with a landed Duke+ ruler are safe
				OR = {
					any_held_title = { tier >= tier_barony }
					is_landless_ruler = yes
				}
			}
			any_claim = {		
				tier >= tier_barony
			}
		}
		
		#Mod support, check zzzzz_olympia_actow_mod_support.txt
		acotw_has_important_modded_trait_or_quality = yes
	}
}

#Guest/Pool Check more Aggressive
olympia_possible_cull_trigger_pool = {
	NOR = {
		health >= fine_health
		has_character_flag = acotw_cull_immunity				#These are characters that are always immune flag set at birth
		exists = inspiration
		is_pregnant = yes
		OR = {
			diplomacy >= 20
			martial >= 20
			stewardship >= 20
			intrigue >= 20
			learning >= 20
			prowess >= 20
		}
		any_claim = {		
			tier >= tier_duchy
		}
		any_close_family_member = {								#Anyone with a close landed Count+ relative is safe
			OR = {
				any_held_title = { tier >= tier_county }
				is_landless_ruler = yes
			}
		}
		
		AND = {
			age <= 35
			OR = {
				num_of_good_genetic_traits > 0
				num_of_bad_genetic_traits > 0
			}
		}
		
		#Mod support, check zzzzz_olympia_actow_mod_support.txt
		acotw_has_important_modded_trait_or_quality = yes
	}
}

acotw_character_can_be_obscured = {
	NOR = {
		has_trait = acotw_obscured
		has_character_flag = acotw_do_not_obscure
		
		#Mod support, check zzzzz_olympia_actow_mod_support.txt
		acotw_prevent_obscured_trait_from_being_add = yes
	}
}

is_available_adult = {		#Prevents Activities: Feasts Chariot Races Debates Festivals Blots Hunt Local Exams Pilgrimage Tournaments University Visits Witch Rituals
	is_available_quick = {	#Prevents Decisions: Cadet Branches Create Holy Orders Lifestyle Decisions Kingdom Creations 
		adult = yes
		alive = yes
		travel = no
		in_army = no
		imprisoned = no
		incapable = no
	}
	has_contagious_deadly_disease_trigger = no
	custom_description = {
		text = ALREADY_IN_ACTIVITY
		NOR = {
			exists = involved_activity
			has_variable = {
				name = homage_liege_scope
				name = meditation_character_flag
				name = local_shrine_rite
				name = petition_liege_character_flag
				name = holding_court_character_flag
			}
			is_being_visited_on_tour_strict = yes
		}
	}
	custom_description = {
		text = ALREADY_PLANNING_ACTIVITY
		NOT = { has_character_flag = planning_an_activity }
	}
	# Variable set within the adventure inspiration events
	NOT = { has_variable = gone_adventuring }
	
	#Olympia restricted many activities and decisions to just Kings or higher
	custom_description = {
		text = OBSCURED_NOT_A_KING
		OR = { 
			has_game_rule = acotw_restrict_activities_off
			AND = {
				is_ruler = yes
				highest_held_title_tier >= tier_kingdom
			}
			AND = {
				has_game_rule = acotw_restrict_activities_dukes_on
				is_ruler = yes
				highest_held_title_tier >= tier_duchy
			}
			NOT = { has_trait = acotw_obscured }
		}
	}
}

#Controls the can_raid rule.
can_raid_trigger = {
	OR = {
		# Government logic.
		government_has_flag = government_can_raid_rule
		## Admin - Frontier themes
		vassal_contract_has_flag = admin_theme_can_raid
		## Clan - Ghazi
		vassal_contract_has_flag = vassal_contract_allow_raiding
		# Faith Logic.
		faith = { has_doctrine_parameter = faith_can_raid }
		# Dynasty logic.
		dynasty ?= {
			OR = {
				can_raid_dynasty_modifiers_that_enable_raiding_overseas_list_trigger = yes
				can_raid_dynasty_modifiers_that_enable_raiding_overland_list_trigger = yes
			}
		}
		# House logic.
		house ?= {
			OR = {
				can_raid_house_modifiers_that_enable_raiding_overseas_list_trigger = yes
				can_raid_house_modifiers_that_enable_raiding_overland_list_trigger = yes
			}
		}
		# Cultural logic.
		## With restrictions.
		AND = {
			can_raid_cultural_parameter_requirements_for_non_tribals_trigger = yes
			culture = {
				OR = {
					has_cultural_parameter = culture_can_raid_at_sea_even_if_feudal
					has_cultural_parameter = culture_can_raid_over_land_even_if_feudal
				}
			}
		}
		## Without restrictions.
		culture = {
			OR = {
				has_cultural_parameter = culture_can_raid_at_sea_even_if_feudal_no_restrictions
				has_cultural_parameter = culture_can_raid_over_land_even_if_feudal_no_restrictions
			}
		}
		# Trait logics.
		## With restrictions.
		AND = {
			can_raid_trait_flag_standard_requirements_trigger = yes
			has_trait_with_flag = trait_enable_raiding_per_standard_restrictions
		}
		## Without restrictions.
		has_trait_with_flag = trait_enable_raiding_without_restrictions
	}
	# Some faiths prohibit this.
	OR = {
		NOR = {
			faith = { has_doctrine_parameter = holy_wars_forbidden }
			government_has_flag = government_is_landless_adventurer
		}
		# But not for Nomads or Wanua
		government_has_flag = government_is_nomadic
		government_has_flag = government_is_wanua
	}
	
	#Olympia restricted raiding to only Kings or higher
	custom_description = {
		text = OBSCURED_NOT_A_KING
		OR = { 
			has_game_rule = acotw_restrict_raiding_off
			AND = {
				is_ruler = yes
				highest_held_title_tier >= tier_kingdom
			}
			AND = {
				has_game_rule = acotw_restrict_raiding_on
				is_ruler = yes
				highest_held_title_tier >= tier_duchy
			}
			NOT = { has_trait = acotw_obscured }
		}
	}
}

olympia_acotw_modifier_adjustments_needed = {
	OR = {
		AND = {
			has_game_rule = acotw_health_adjustments_on
			NOT = { has_character_modifier = acotw_olympia_health_adjustments }
		}
		AND = {
			OR = {
				has_game_rule = acotw_ruler_adjustments_domain_only
				has_game_rule = acotw_ruler_adjustments_all_on
			}
			NOT = { has_character_modifier = acotw_olympia_ruler_domain_increase }
		}
		AND = {
			OR = {
				has_game_rule = acotw_ruler_adjustments_knights_only
				has_game_rule = acotw_ruler_adjustments_all_on
			}
			NOT = { has_character_modifier = acotw_olympia_war_reduction }
		}
	}
}