﻿#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
		government_has_flag = government_is_urepublic
		government_has_flag = government_is_prepublic
	}
	is_landed = yes
}

# Here so that you can plug in whatever dynasty modifiers you want without overwriting the whole scripted rule trigger.
can_raid_dynasty_modifiers_that_enable_raiding_overseas_list_trigger = {
	# Yes, I realise the OR is redundant till someone else puts something in here. Shoosh.
		has_dynasty_modifier = fp1_legacy_of_piracy_modifier

}
can_raid_dynasty_modifiers_that_enable_raiding_overland_list_trigger = {
	OR = {
		# Yes, I realise the OR is redundant till someone else puts something in here. Shoosh.
		# Always = no because we have no vanilla use-case atm — the assumption is that modders'll overwrite it.
		always = no
	}
}

# Here so that you can plug in whatever house modifiers you want without overwriting the whole scripted rule trigger.
can_raid_house_modifiers_that_enable_raiding_overseas_list_trigger = {
	OR = {
		# Yes, I realise the OR is redundant till someone else puts something in here. Shoosh.
		# Always = no because we have no vanilla use-case atm — the assumption is that modders'll overwrite it.
		always = no
	}
}
can_raid_house_modifiers_that_enable_raiding_overland_list_trigger = {
	OR = {
		# Yes, I realise the OR is redundant till someone else puts something in here. Shoosh.
		# Always = no because we have no vanilla use-case atm — the assumption is that modders'll overwrite it.
		always = no
	}
}

# Here so that you can tweak the rules on how non-tribals raid via CulTrad without overriding the whole scripted rule trigger.
can_raid_cultural_parameter_requirements_for_non_tribals_trigger = {
	OR = {
		highest_held_title_tier <= tier_duchy
		realm_size <= minor_realm_size
	}
}

# Here so that you can tweak the rules on which innovations allow raiding without overriding the whole scripted rule trigger.
can_ran_raid_overseas_cultural_innovations_trigger = {
	OR = {
		has_innovation = innovation_longboats
		has_innovation = innovation_african_canoes
	}
}

# Here so that you can tweak the rules on characters with a trait that lets them raid under certain circumstances raid without overriding the whole scripted rule trigger.
can_raid_trait_flag_standard_requirements_trigger = {
	# We don't use this in vanilla, so we don't have any actual requirements atm.
	always = yes
}

can_raid_across_water_trigger = {
	OR = {
		# Culture logic.
		culture = {
			OR = {
				can_ran_raid_overseas_cultural_innovations_trigger = yes
				has_cultural_parameter = culture_can_raid_at_sea_even_if_feudal
				has_cultural_parameter = culture_can_raid_at_sea_even_if_feudal_no_restrictions
			}
		}
		# Dynasty logic.
		dynasty ?= { can_raid_dynasty_modifiers_that_enable_raiding_overseas_list_trigger = yes }
		# House logic.
		house ?= { can_raid_house_modifiers_that_enable_raiding_overseas_list_trigger = yes }
		# Can raid overseas by government rules
		government_has_flag = government_enables_naval_raiding
		#Is Hereward.
		has_trait = the_wake
	}
}
