﻿start_theft_interaction = {
	icon = icon_scheme_theft  #ICON
	common_interaction = yes
	interface_priority = 10
	category = interaction_category_hostile

	ignores_pending_interaction_block = yes

	scheme = theft_scheme

	send_name = START_SCHEME

	is_shown = {
		scope:actor = {is_adult = yes}
		NOT = { scope:recipient = scope:actor }
		has_game_rule = cki_rule_theft_active
		scope:recipient = {
			is_adult = yes
			gold > 1	
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			can_start_scheme = {
				type = theft_scheme
				target_character = scope:recipient
			}
		}
		scope:recipient = { 
			is_adult = yes
			gold > 1
			NOT = { 
				has_strong_hook = scope:actor 
				has_opinion_modifier = {target = scope:actor modifier = theft_discovered_opinion}
			} 
		}
		trigger_if = {
			limit = {
				scope:actor = {
					is_landless_adventurer = yes
				}
			}
			#Has to be used instead of diplo range checks in laamp to landed interactions
			ep3_laamp_diplo_range_trigger = {
				TARGET = scope:recipient
				LAAMP = scope:actor
			}
		}
	}

	desc = {
		triggered_desc = {
			trigger = {
				scope:actor = {
					can_start_scheme = {
						type = theft_scheme
						target_character = scope:recipient
					}
				}
			}
			desc = scheme_interaction_tt_theft_approved
		}
	}

	# Scheme Starter Packages
	options_heading = schemes.t.agent_packages
	send_options_exclusive = yes
	## Balanced agents.
	send_option = {
		flag = agent_focus_balance
		current_description = start_theft_interaction.tt.agent_focus_balance
	}
	## Focused on Success Chance.
	send_option = {
		flag = agent_focus_success
		current_description = start_theft_interaction.tt.agent_focus_success
	}
	## Focused on Speed.
	send_option = {
		flag = agent_focus_speed
		current_description = start_theft_interaction.tt.agent_focus_speed
	}
	## Focused on Secrecy.
	send_option = {
		flag = agent_focus_secrecy
		current_description = start_theft_interaction.tt.agent_focus_secrecy
	}

	on_accept = {
		scope:actor = {
			stress_impact = {
				compassionate = major_stress_impact_gain
				honest = medium_stress_impact_gain
				just = medium_stress_impact_gain
				greedy = medium_stress_impact_loss
				avaricious = medium_stress_impact_loss
			}
		}
		scope:actor = {
			send_interface_toast = {
				type = event_toast_effect_neutral
				title = start_theft_interaction_notification

				left_icon = scope:actor					
				right_icon = scope:recipient

				# Success.
				if = {
					limit = { scope:agent_focus_success ?= yes }
					begin_scheme_with_agents_effect = {
						SCHEME_TYPE = theft_scheme
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
						# Success.
						AGENT_1 = agent_thief
						AGENT_2 = agent_ambusher
						AGENT_3 = agent_thief
						# Speed.
						AGENT_4 = agent_infiltrator
						# Secrecy.
						AGENT_5 = agent_lookout
					}
				}
				# Speed.
				else_if = {
					limit = { scope:agent_focus_speed ?= yes }
					begin_scheme_with_agents_effect = {
						SCHEME_TYPE = theft_scheme
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
						# Success.
						AGENT_1 = agent_thief
						AGENT_2 = agent_ambusher
						# Speed.
						AGENT_3 = agent_infiltrator
						AGENT_4 = agent_infiltrator
						# Secrecy.
						AGENT_5 = agent_lookout
					}
				}
				# Secrecy.
				else_if = {
					limit = { scope:agent_focus_secrecy ?= yes }
					begin_scheme_with_agents_effect = {
						SCHEME_TYPE = theft_scheme
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
						# Success.
						AGENT_1 = agent_thief
						# Speed.
						AGENT_2 = agent_infiltrator
						# Secrecy.
						AGENT_3 = agent_lookout
						AGENT_4 = agent_lookout
						AGENT_5 = agent_lookout
					}
				}
				# Balanced.
				else = {
					begin_scheme_with_agents_effect = {
						SCHEME_TYPE = theft_scheme
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
						# Success.
						AGENT_1 = agent_thief
						AGENT_2 = agent_ambusher
						# Speed.
						AGENT_3 = agent_infiltrator
						AGENT_4 = agent_footpad
						# Secrecy.
						AGENT_5 = agent_lookout
					}
				}
			}
		}
	}
	
	auto_accept = yes
	ai_targets = { 
		ai_recipients = neighboring_rulers
		ai_recipients = peer_vassals
		ai_recipients = liege
	 }
	ai_frequency = 60

	ai_potential = {
		is_adult = yes
		intrigue > 10
		gold < 500
		OR = {
			is_ruler = yes
			intrigue > 18
		}
	}

	ai_will_do = {
		# They shouldn't always do this.
		base = -20

		# Obvious factor.
		opinion_modifier = {
			opinion_target = scope:recipient
			multiplier = -1
		}
		ai_value_modifier = { ai_honor = -1 }
		# Traits.
		## Disloyal.
		modifier = {
			add = 80
			has_trait = disloyal
		}
		## Ambitious.
		modifier = {
			add = 75
			has_trait = ambitious
		}
		## Arrogant.
		modifier = {
			add = 25
			has_trait = arrogant
		}
		## Fickle.
		modifier = {
			add = 25
			has_trait = fickle
		}
		## Callous.
		modifier = {
			add = 25
			has_trait = callous
		}
		## Compassionate.
		modifier = {
			add = -50
			has_trait = compassionate
		}
		## Content.
		modifier = {
			add = -100
			has_trait = content
		}
		## Greedy.
		modifier = {
			add = 80
			has_trait = greedy
		}
	}
}


