﻿poison_opinion_interaction = {
	icon = poison_opinion
	category = interaction_category_friendly
	common_interaction = no

	send_name = START_SCHEME

	interface_priority = 75

	scheme = poison_opinion
	ignores_pending_interaction_block = yes

	is_shown = {
		NOT = { scope:actor = scope:recipient }
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			can_start_scheme = {
				type = poison_opinion
				target_character = scope:recipient
			}
		}
		#limit range for landless adventurers
		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 = poison_opinion_interaction_desc

	on_accept = {
		scope:actor = {
			send_interface_toast = {
				type = event_toast_effect_neutral
				title = poison_opinion_interaction_notification

				left_icon = scope:actor					
				right_icon = scope:recipient

				begin_scheme_basic_effect = {
					SCHEME_TYPE = poison_opinion
					TARGET_TYPE = target_character
					TARGET_SCOPE = scope:recipient
				}
			}
		}
	}
	ai_target_quick_trigger = {
		adult = yes
	}
	ai_targets = {
		ai_recipients = peer_vassals
		ai_recipients = domicile_location_neighboring_top_realm_vassals
		max = 10
	}
	ai_frequency_by_tier = {
		barony = 0
		county = 0
		duchy = 24
		kingdom = 0
		empire = 0
		hegemony = 0
	}

	ai_potential = {
		NOR = {
			scheme_generic_ai_blocker_trigger = yes
			primary_title = {
				is_mercenary_company = yes
			}
		}
		exists = court_position:femme_fatale_court_position
		exists = var:femme_fatale_is_poisoning_opinion
		var:femme_fatale_is_poisoning_opinion = yes
	}

	auto_accept = yes
	
	ai_will_do = {
		base = 0
		modifier = {
			OR = {
				# Dislikes target's liege
				scope:actor = {
					opinion = {
						target = scope:recipient.liege
						value < 0
					}
				}
				# Recipient likes their liege
				scope:recipient = {
					opinion = {
						target = scope:recipient
						value > 0
					}
				}
			}
			add = 50
		}
		
		# Provoked Faction exists
		modifier = {
			scope:recipient.liege = {
				any_targeting_faction = {
					OR = {
						faction_is_type = provoked_dissolution_faction
						faction_is_type = provoked_independence_faction
					}
				}
			}
			add = 100
		}
	}
}