﻿
diplomacy_scheme_trigger = {
	OR = {
		scheme_type = befriend
		scheme_type = sway
		scheme_type = courting
	}
}

intrigue_scheme_trigger = {
	OR = {
		scheme_type = murder
		scheme_type = abduct
		scheme_type = fabricate_hook
		scheme_type = steal_back_artifact
	}
}

# Should be synced with the schemes listed in can_start_hostile_scheme_against_trigger.
hostile_scheme_trigger = {
	OR = {
		scheme_type = murder
		scheme_type = abduct
		scheme_type = claim_throne
		scheme_type = fabricate_hook
		scheme_type = steal_back_artifact
	}
}

friendly_scheme_trigger = {
	OR = {
		scheme_type = seduce
		scheme_type = befriend
		scheme_type = sway
		scheme_type = courting
	}
}

# Should be synced with the schemes listed in hostile_scheme_trigger.
can_start_hostile_scheme_against_trigger = {
	OR = {
		can_start_scheme = {
			type = murder
			target_character = $TARGET$
		}
		can_start_scheme = {
			type = abduct
			target_character = $TARGET$
		}
		can_start_scheme = {
			type = claim_throne
			target_character = $TARGET$
		}
		can_start_scheme = {
			type = fabricate_hook
			target_character = $TARGET$
		}
		can_start_scheme = {
			type = steal_back_artifact
			target_character = $TARGET$
		}
	}
}

agent_valid_to_be_discovered_by_spymaster = {
	trigger_if = {
		limit = {
			exists = scope:target.court_owner.cp:councillor_spymaster
		}
		this != scope:target.court_owner.cp:councillor_spymaster
	}
	NOT = {
		has_character_flag = free_to_scheme
	}
	trigger_if = {
		limit = {
			exists = scope:target.court_owner
		}
		NOR = {
			reverse_has_opinion_modifier = {
				target = scope:target.court_owner
				modifier = scheming_against_me
			}
			reverse_has_opinion_modifier = {
				target = scope:target.court_owner
				modifier = schemed_against_me
			}
		}
	}
}

personal_scheme_should_not_evaluate_tier_differences_trigger = {
	# Your spouse doesn't care if you're a different rank than them.
	scope:owner = {
		NOT = { is_consort_of = scope:target }
	}
	# And laamps are never bothered either way.
	scope:owner = { is_landless_adventurer = no }
	scope:target = { is_landless_adventurer = no }
}

personal_scheme_success_compare_target_liege_tier_trigger = {
	is_landed_or_landless_administrative = no
	exists = liege
	OR = {
		is_spouse_of = liege
		is_close_family_of = liege
		dynasty = liege.dynasty
	}
}

is_good_familial_murder_target_trigger = {
	root = {
		can_start_scheme = {
			target_character = prev
			type = murder
		}
		OR = {
			AND = { # Psychopaths ignore opinion...
				ai_greed >= very_high_positive_ai_value
				ai_compassion <= very_high_negative_ai_value
				has_trait = sadistic # Make sadistic people able to murder their own children
			}
			AND = { # Very greedy and non-compassionate characters almost ignore opinion...
				ai_greed >= very_high_positive_ai_value
				ai_compassion <= high_negative_ai_value
				opinion = {
					target = prev
					value <= medium_positive_opinion
				}
			}
			AND = { # Significantly greedy and non-compassionate characters can murder even at positive opinion
				ai_greed >= high_positive_ai_value
				ai_compassion < 0
				opinion = {
					target = prev
					value <= low_positive_opinion
				}
			}
			AND = { # Somewhat greedy characters can murder people they just barely dislike...
				ai_greed >= medium_positive_ai_value
				opinion = {
					target = prev
					value <= low_negative_opinion
				}
			}
			AND = { # Otherwise, their opinion must be rather poor...
				opinion = {
					target = prev
					value <= medium_negative_opinion
				}
			}
		}
	}
	NOR = {
		has_opinion_modifier = {
			modifier = received_title_county
			target = root
		}
		has_opinion_modifier = {
			modifier = received_title_duchy
			target = root
		}
		has_opinion_modifier = {
			modifier = received_title_kingdom
			target = root
		}
		has_opinion_modifier = {
			modifier = received_title_empire
			target = root
		}
	}
	#is a valid murder target if scheme owner is in line of succession to any of target's titles or at least 3rd in line of succession to any titles the target is 1st to inherit
	OR = {
		any_held_title = {
			tier >= root.highest_held_title_tier
			place_in_line_of_succession = {
				target = root
				value <= {
					value = 2
					if = {
						limit = { root.highest_held_title_tier > tier_barony }
						add = 1
					}
				}
			}
		}
		any_heir_title = {
			holder != root
			tier >= root.highest_held_title_tier
			place_in_line_of_succession = {
				target = root
				value <= {
					value = 2
					if = {
						limit = { root.highest_held_title_tier > tier_barony }
						add = 1
					}
				}
			}
		}
	}
}

# This trigger is a bit contrived in some way to ensure absolutely everyone gets evaluated without any early-outing
# It should always return true
# We use "count = all" and trigger_ifs to ensure that all have to be evaluated, and that all return
build_murder_targets_trigger = {
	any_relation = { # Rivals are good targets for murder schemes
		type = rival
		count = all
		trigger_if = {
			limit = {
				root = {
					trigger_if = {
						limit = {
							has_relation_nemesis = prev
						}
						ai_honor <= medium_positive_ai_value
					}
					trigger_else = {
						ai_honor <= low_positive_ai_value
					}
					can_start_scheme = {
						target_character = prev
						type = murder
					}
				}
			}
			add_to_temporary_list = murder_targets
		}
	}
	trigger_if = { # Greedy people have no qualms murdering their way up the succession...
		limit = {
			ai_greed >= low_positive_ai_value
			exists = dynasty
		}
		dynasty = {
			any_dynasty_member = {
				count = all
				trigger_if = {
					limit = {
						is_good_familial_murder_target_trigger = yes
					}
					add_to_temporary_list = murder_targets
				}
			}
		}
		any_close_or_extended_family_member = {
			count = all
			trigger_if = {
				limit = {
					NOT = { is_in_list = murder_targets }
					is_good_familial_murder_target_trigger = yes
				}
				add_to_temporary_list = murder_targets
			}
		}
	}
	trigger_if = { # Greedy people want to murder their liege's high aptitude tax collector...
		limit = {
			ai_greed >= low_positive_ai_value
			top_liege != this
			government_has_flag = government_is_clan
			liege ?= {
				any_tax_collector = {
					any_tax_collector_vassal = {
						this = root
					}
					tax_collector_aptitude = {
						target = clan_tax_slot
						value >= 4
					}
					add_to_temporary_list = murder_targets
				}
			}
		}
	}
	trigger_if = { # Some Clan members want to murder Extolled people out of pure spite and malice
		limit = {
			ai_greed >= 0
			ai_vengefulness >= 0
			ai_compassion <= medium_negative_ai_value
			house.house_head ?= {
				is_ruler = yes
				government_has_flag = government_is_clan
			}
			ai_wants_low_unity = yes
		}
		house = {
			any_house_member = {
				has_trait = extolled
				add_to_temporary_list = murder_targets
			}
		}
	}
	any_consort = { # Unfaithful spouses
		trigger_if = {
			limit = {
				root = {
					ai_compassion <= 0
					can_start_scheme = {
						target_character = prev
						type = murder
					}
				}
				exposed_cheating_on_spouse_trigger = { SPOUSE = root }
				add_to_temporary_list = murder_targets
			}
		}
	}
	trigger_if = { # Certain vassals will plot against their liege under certain conditions
		limit = {
			highest_held_title_tier > tier_barony
			liege ?= {
				tyranny >= medium_tyranny
			}
			opinion = {
				target = liege
				value <= high_negative_opinion
			}
			ai_rationality >= medium_positive_ai_value
		}
		liege = {
			add_to_temporary_list = murder_targets
		}
	}
	trigger_if = { # Murdering troublesome claimants is something you want to do...
		limit = {
			is_landed = yes
			primary_title.tier >= tier_duchy
			any_targeting_faction = {
			  	faction_type = claimant_faction
				special_character = {
					add_to_temporary_list = murder_targets
				}
			}
		}
	}
	trigger_if = { # Paranoid characters want to murder claimants to their titles
		limit = {
			ai_compassion <= low_negative_ai_value
			ai_rationality <= 0
			is_landed = yes
			has_trait = paranoid
			primary_title.tier >= tier_duchy
			any_held_title = {
				any_claimant = {
					add_to_temporary_list = murder_targets
				}
			}
		}
	}
	any_spouse = { # Murder infertile spouses if you've yet to have an heir (and you're heartless...)
		trigger_if = {
			limit = {
				fertility < 0.1
				is_ai = yes
				root = {
					ai_compassion <= 0
					ai_honor <= 0
					fertility > 0.1
					is_playable_character = yes
					NOT = {
						any_child = {
							is_heir_of = root
						}
					}
					can_start_scheme = {
						target_character = prev
						type = murder
					}
				}
				add_to_temporary_list = murder_targets
			}
		}
	}
}

scheme_is_still_valid_trigger = {
	scope:target = {
		OR = {
			exists = location
			in_diplomatic_range = scope:owner
		}
	}
}

can_use_befriend_scheme_trigger = {
	OR = {
		AND = {
			house ?= { has_house_head_parameter = unlock_befriend_scheme }
			is_house_head = yes
		}
		has_perk = befriend_perk
		AND = {
			dynasty ?= {
				has_dynasty_perk = fp1_adventure_legacy_5
			}
			target_is_vassal_or_below = $TARGET$
		}
		culture = { has_cultural_parameter = automatic_befriend_access }
		any_character_struggle = {
			involvement = involved
			has_struggle_phase_parameter = struggle_unlocks_befriend_schemes_for_everyone
		}
		AND = {
			government_has_flag = government_is_clan
			is_in_same_clan_as_trigger = { CHARACTER = $TARGET$ }
			house = { has_house_unity_stage = harmonious }	
		}
		government_has_flag = government_is_nomadic	
	}
}

# Need to separate travel triggers from rest
can_seduce_scheme_trigger = {
	$OWNER$ = {
		is_adult = yes
		is_imprisoned = no
		OR = {
			is_ai = no	#Players may override their character's sexuality for the purposes of cynical seductions.
			is_attracted_to_gender_of = $TARGET$
		}
		is_below_ai_lover_soft_cap_trigger = yes
		NOR = {
			has_trait = celibate
			has_character_flag = is_party_baron
			has_relation_lover = $TARGET$
			guaranteed_under_20_incest_rejection_trigger = {
				TARGET = $TARGET$
				SEDUCER = $OWNER$
			}
			AND = {
				has_character_modifier = rejected_from_marriage_bed_modifier
				is_spouse_of = $TARGET$
			}
		}
	}
	$TARGET$ = {
		is_adult = yes
		is_imprisoned = no
		is_attracted_to_gender_of = $OWNER$
		NOR = {
			has_character_flag = block_seduce_attempts
			has_trait = intellect_bad_3
			has_trait = incapable
			has_trait = celibate
			has_opinion_modifier = {
				modifier = seduce_permanent_blocker_opinion
				target = $OWNER$
			}
			has_opinion_modifier = {
				modifier = seduce_regular_cooldown_opinion
				target = $OWNER$
			}
		}
		OR = {
			exists = location
			in_diplomatic_range = $OWNER$
		}
		trigger_if = {
			limit = {
				$OWNER$ = { is_ai = yes }
			}
			is_below_ai_lover_soft_cap_trigger = yes
			trigger_if = { # Block AI from seducing lowborn nobodies in the players court
				limit = {
					liege ?= { is_ai = no }
					NOR = {
						is_courtier_of = $OWNER$
						is_foreign_court_or_pool_guest_of = $OWNER$
					}
				}
				OR = {
					is_lowborn = no
					is_playable_character = yes
				}
			}
			trigger_if = { #So players don't get spammed by AI seduction
				limit = { is_ai = no }
				NOT = {
					any_targeting_scheme = { scheme_type = seduce }
				}
			}
		}
	}
}

##################################################
# Scheme Ending Triggers

# Is this a scheme to kill someone who could be conceivably saved by something unexpected?
is_savable_murder_scheme_trigger = {
	OR = {
		scheme_type = murder
		scheme_type = laamp_base_3011_contract_scheme
	}
}

# Could & would this lover of $TARGET$ 
available_lover_to_sacrifice_in_murder_trigger = {
	is_ruler = no
	is_available_ai_adult = yes
	# Filter out lovers that don't actually like you at all.
	NOT = { has_trait = disloyal }
	OR = {
		has_trait = loyal
		opinion = {
			target = $TARGET$
			# And frankly this is being generous.
			value >= 1
		}
	}
}

##################################################
# Murder Intercept Triggers

# Would this character slack off from their task of guarding scope:target?
bodyguard_will_actually_do_job_trigger = {
	# Basically functional.
	is_ruler = no
	is_physically_able_ai_adult = yes
	# Can't hate their charge.
	save_temporary_scope_as = char_temp
	NOR = {
		# Require that they don't hate their liege.
		has_relation_rival = scope:target
		opinion = {
			target = scope:target
			value <= high_negative_opinion
		}
		# Can't be directly involved with the scheme either.
		scope:scheme = {
			any_scheme_agent_character = { this = scope:char_temp }
		}
		scope:owner = scope:char_temp
	}
}
foodtaster_will_actually_do_job_trigger = {
	# Basically functional.
	is_ruler = no
	is_physically_able_ai_adult = yes
	# Can't be directly involved with the scheme.
	## We're a bit pickier here, since food tasters can't just slack off from their duties like bodyguards or cupbearers arguably can.
	### You eat the food or you don't, so if you don't, you really must've planned ahead to look like you did.
	save_temporary_scope_as = char_temp
	NOR = {
		scope:scheme = {
			any_scheme_agent_character = { this = scope:char_temp }
		}
		scope:owner = scope:char_temp
	}
}
cupbearer_will_actually_do_job_trigger = {
	# Basically functional.
	is_physically_able_ai_adult = yes
	# Can't hate their charge.
	save_temporary_scope_as = char_temp
	NOR = {
		# Require that they don't hate their liege.
		has_relation_rival = scope:target
		opinion = {
			target = scope:target
			value <= high_negative_opinion
		}
		# Can't be directly involved with the scheme either.
		scope:scheme = {
			any_scheme_agent_character = { this = scope:char_temp }
		}
		scope:owner = scope:char_temp
	}
}

##################################################
# Scheme Animation Triggers

should_use_amorous_scheme_animation_trigger = {
	OR = {
		scheme_type = seduce
		scheme_type = elope
		scheme_type = courting
	}
}

##################################################
# Agent Invite Triggers

would_agent_accept_petty_bribes_against_target_trigger = {
	exists = scope:scheme
	trigger_if = {
		limit = {
			exists = scope:scheme.scheme_target_character
		}
		NOT = {
			scope:recipient = { is_parent_of = scope:scheme.scheme_target_character }
		}
	}
	trigger_if = {
		limit = {
			exists = scope:scheme.scheme_target_title
		}
		NOT = {
			scope:recipient = { is_parent_of = scope:scheme.scheme_target_title.holder }
		}
	}
}

would_actor_consider_dramatic_enticement_trigger = {
	scope:actor = {
		OR = {
			is_ai = no
			has_trait = humble
			has_trait = content
			has_trait = profligate
			AND = {
				has_trait = vengeful
				has_relation_rival = scope:recipient
			}
			AND = {
				has_trait = impatient
				NOR = {
					has_trait = arrogant
					has_trait = ambitious
				}
			}
		}
	}
}

actor_has_valid_de_jure_enticement_county_trigger = {
	holder = scope:actor
	tier = tier_county
	this != scope:actor.capital_county
}

actor_has_valid_claimed_enticement_county_trigger = {
	holder = scope:actor
	tier = tier_county
	this != scope:actor.capital_county
}

##################################################
# Can Add Agent to Scheme Triggers

char_can_fit_into_scheme_trigger = {
	save_temporary_scope_as = char_temp
	$SCHEME$ = {
		any_scheme_agent_slot = {
			is_filled = no
			save_temporary_scope_as = slot_temp
		}
		scope:char_temp = { is_valid_as_agent_in_slot = scope:slot_temp }
	}
}

##################################################
# Scheme APA Triggers

scheme_apa_apply_modifier_plus_secrecy_trigger = {
	scheme_apa_apply_modifier_trigger = { MODIFIER = $MODIFIER$ }
}

scheme_apa_apply_modifier_trigger = {
	NOR = {
		has_variable = scheme_pulse_action_on_cooldown
		has_scheme_modifier = $MODIFIER$
	}
}

scheme_apa_apply_positive_progress_trigger = {
	NOT = { has_variable = scheme_pulse_action_on_cooldown }
	# How many days in before we want to allow progress gains?
	scheme_duration_days >= 365
}

scheme_apa_apply_negative_progress_trigger = {
	NOT = { has_variable = scheme_pulse_action_on_cooldown }
	save_temporary_scope_as = scheme
	scheme_progress > scheme_progress_33
}

##################################################
# Agent Availability Triggers

can_have_agent_hitman_trigger = { always = yes }
can_have_agent_assassin_trigger = { always = yes }
can_have_agent_lookout_trigger = { always = yes }
can_have_agent_infiltrator_trigger = { always = yes }
can_have_agent_footpad_trigger = { always = yes }
can_have_agent_alibi_trigger = { always = yes }
can_have_agent_thug_trigger = { always = yes }
can_have_agent_comrade_in_arms_trigger = { always = yes }
can_have_agent_socialite_trigger = { always = yes }
can_have_agent_musician_trigger = { always = yes }
can_have_agent_tumbler_trigger = { always = yes }
can_have_agent_poet_trigger = { always = yes }
can_have_agent_gabbler_trigger = { always = yes }
can_have_agent_shill_trigger = { always = yes }
can_have_agent_diplomat_trigger = { always = yes }
can_have_agent_justiciar_trigger = { always = yes }
can_have_agent_justiciar_speed_trigger = { always = yes }
can_have_agent_scribe_trigger = { always = yes }
can_have_agent_cleric_trigger = { always = yes }
can_have_agent_theologian_trigger = { always = yes }
can_have_agent_herald_trigger = { always = yes }
can_have_agent_wolf_hunter_trigger = { always = yes }
can_have_agent_thief_trigger = { always = yes }
can_have_agent_tutor_trigger = { always = yes }
can_have_agent_poisoner_trigger = {
	domicile ?= { has_domicile_parameter = camp_unlocks_poisoner_scheme_agents }
}
can_have_agent_muscle_trigger = { always = yes }
can_have_agent_drillmaster_trigger = { always = yes }
can_have_agent_tracker_trigger = { always = yes }
can_have_agent_physic_trigger = { always = yes }
can_have_agent_smith_trigger = { always = yes }
can_have_agent_ambusher_trigger = { always = yes }
can_have_agent_bodyguard_trigger = { always = yes }
can_have_agent_scout_trigger = { always = yes }
can_have_agent_outrider_trigger = { always = yes }
can_have_agent_bookkeeper_trigger = { always = yes }
can_have_agent_bailiff_trigger = { always = yes }
can_have_agent_draughtsman_trigger = { always = yes }
can_have_agent_planner_trigger = { always = yes }
can_have_agent_supplier_trigger = { always = yes }
can_have_agent_outcast_trigger = { always = yes }
can_have_agent_wrangler_trigger = { always = yes }
can_have_agent_decoy_trigger = { always = yes }
can_have_agent_eunuch_trigger = { always = yes }
can_have_agent_wrangler_speed_trigger = { always = yes }
can_have_agent_theologian_success_trigger = { always = yes }
can_have_agent_cleric_success_trigger = { always = yes }
can_have_agent_lookout_success_trigger = { always = yes }
can_have_agent_lookout_speed_trigger = { always = yes }

##################################################
# Countermeasure Triggers

# Does a specific countermeasure apply to you?
countermeasure_parametre_applies_againt_char_trigger = {
	$SCHEME_TARGET$.host ?= {
		has_scheme_countermeasure_parameter = $PARAMETER$
		# Don't apply countermeasures vs. ourselves.
		NOT = { this = $SCHEME_OWNER$ }
		# And if the countermeasure only affects the host, then restrict it.
		trigger_if = {
			limit = { has_scheme_countermeasure_parameter = countermeasure_only_affects_court_holder }
			this = $SCHEME_TARGET$
		}
	}
}

# Can a character adopt defensive measures against hostile schemes?
can_set_own_countermeasures_trigger = {
	custom_tooltip = {
		OR = {
			# You can only set them for your home court.
			host = prev
			# And then we use this in here so we can valid
			## ... valid what, Ewan? _What can we valid_? You never finished your sentence and now we will never know.
			is_ruler = no
		}
		text = can_set_own_countermeasures_trigger.tt
	}
}

# Used in scripted modifiers to determine if the AI should be deploying countermeasures that reduce secrecy or generally affect success chance.
should_ai_take_preemptive_countermeasures_trigger = {
	# Don't do this if we've already deployed countermeasures.
	NOT = { has_scheme_countermeasure_parameter = has_any_countermeasure_active }
	any_targeting_scheme = {
		# Make sure we'd need to do this at all.
		has_variable = apply_countermeasures
		# And we don't want to face schemes that're already at a later stage.
		is_scheme_exposed = no
		# Buuuut also give them their grace period to get started.
		has_variable = secrecy_grace_period
		var:secrecy_grace_period <= 0
	}
}

##################################################
# Countermeasure Access Triggers

# This trigger means that a character will only ever have access to the best version of a given countermeasure.
## Please note that some tiers may be inaccessible: they're set up so they can be hooked in to stuff, but we haven't assigned them all out straight away.
## Use them if you want them but don't feel obligated, basically.
scheme_countermeasure_access_select_best_tier_trigger = {
	save_temporary_scope_value_as = {
		name = checked_tier
		value = $TIER$
	}
	trigger_if = {
		limit = { scheme_countermeasure_access_t4_$COUNTERMEASURE$_trigger = yes }
		scope:checked_tier = 4
	}
	trigger_else_if = {
		limit = { scheme_countermeasure_access_t3_$COUNTERMEASURE$_trigger = yes }
		scope:checked_tier = 3
	}
	trigger_else_if = {
		limit = { scheme_countermeasure_access_t2_$COUNTERMEASURE$_trigger = yes }
		scope:checked_tier = 2
	}
	trigger_else = { scope:checked_tier = 1 }
}

# Can this character access the higher tiers of the Bounties for Whispers countermeasure?
scheme_countermeasure_access_t2_bounties_for_whispers_trigger = {
	OR = {
		has_trait_with_flag = trait_unlocks_t2_countermeasures
		culture = { has_cultural_parameter = cultrad_unlocks_t2_countermeasures }
	}
}
scheme_countermeasure_access_t3_bounties_for_whispers_trigger = {
	always = no
}
scheme_countermeasure_access_t4_bounties_for_whispers_trigger = {
	OR = {
		culture = { has_cultural_parameter = cultrad_unlocks_t4_bounties_for_whispers }
		faith = { has_doctrine_parameter = tenet_unlocks_t4_bounties_for_whispers }
	}
}

# Can this character access the higher tiers of the Arbitrary Arrests countermeasure?
scheme_countermeasure_access_t2_arbitrary_arrests_trigger = {
	OR = {
		has_trait_with_flag = trait_unlocks_t2_countermeasures
		has_trait_with_flag = trait_unlocks_t2_arbitrary_arrests
		culture = { has_cultural_parameter = cultrad_unlocks_t2_countermeasures }
	}
}
scheme_countermeasure_access_t3_arbitrary_arrests_trigger = {
	culture = { has_cultural_parameter = cultrad_unlocks_t3_arbitrary_arrests }
}
scheme_countermeasure_access_t4_arbitrary_arrests_trigger = {
	always = no
}

# Can this character access the higher tiers of the Strengthen Sentries countermeasure?
scheme_countermeasure_access_t2_strengthen_sentries_trigger = {
	OR = {
		has_trait_with_flag = trait_unlocks_t2_countermeasures
		culture = { has_cultural_parameter = cultrad_unlocks_t2_countermeasures }
	}
}
scheme_countermeasure_access_t3_strengthen_sentries_trigger = {
	culture = { has_cultural_parameter = cultrad_unlocks_t3_strengthen_sentries }
}
scheme_countermeasure_access_t4_strengthen_sentries_trigger = {
	always = no
}

# Can this character access the higher tiers of the Redouble Guards countermeasure?
scheme_countermeasure_access_t2_redouble_guards_trigger = {
	OR = {
		has_trait_with_flag = trait_unlocks_t2_countermeasures
		culture = {
			OR = {
				has_cultural_parameter = cultrad_unlocks_t2_countermeasures
				has_cultural_parameter = cultrad_unlocks_t2_redouble_guards
			}
		}
	}
}
scheme_countermeasure_access_t3_redouble_guards_trigger = {
	culture = { has_cultural_parameter = cultrad_unlocks_t3_redouble_guards }
}
scheme_countermeasure_access_t4_redouble_guards_trigger = {
	always = no
}

# Can this character access the higher tiers of the Withdraw from View countermeasure?
scheme_countermeasure_access_t2_withdraw_from_view_trigger = {
	OR = {
		OR = {
			has_trait_with_flag = trait_unlocks_t2_countermeasures
			culture = { has_cultural_parameter = cultrad_unlocks_t2_countermeasures }
		}
		has_trait_with_flag = trait_unlocks_t2_withdraw_from_view
	}
}
scheme_countermeasure_access_t3_withdraw_from_view_trigger = {
	OR = {
		has_trait_with_flag = trait_unlocks_t3_withdraw_from_view
		faith = { has_doctrine_parameter = tenet_unlocks_t3_withdraw_from_view }
	}
}
scheme_countermeasure_access_t4_withdraw_from_view_trigger = {
	has_trait_with_flag = trait_unlocks_t4_withdraw_from_view
}

# Can this character access the higher tiers of the Bribe Officials countermeasure?
scheme_countermeasure_access_t2_bribe_officials_trigger = {
	OR = {
		culture = { has_cultural_parameter = cultrad_unlocks_t2_countermeasures }
		domicile ?= { has_domicile_parameter = estate_improve_political_scheme_countermeasure }
	}
}
scheme_countermeasure_access_t3_bribe_officials_trigger = {
	AND = {
		culture = { has_cultural_parameter = cultrad_unlocks_t2_countermeasures }
		domicile ?= { has_domicile_parameter = estate_improve_political_scheme_countermeasure }
	}
}
scheme_countermeasure_access_t4_bribe_officials_trigger = {
	always = no
}

scheme_generic_ai_blocker_trigger = {
	any_scheme = {
		OR = {
			scheme_type = befriend
			scheme_type = sway
			scheme_type = seduce
			scheme_type = courting
			scheme_type = elope
			scheme_type = learn_language
			scheme_type = teach_governor
		}
	}
}
