﻿start_antagonize_council_interaction = {
	icon = icon_antagonize_council  #ICON
	common_interaction = yes
	interface_priority = 10
	category = interaction_category_hostile

	ignores_pending_interaction_block = yes

	scheme = antagonize_council_scheme

	send_name = START_SCHEME

	is_shown = {
		scope:actor = {is_adult = yes}
		NOT = { scope:recipient = scope:actor }
		has_game_rule = cki_rule_antagonize_council_active
		scope:recipient = {
			is_ruler = yes
			highest_held_title_tier >= tier_county
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			can_start_scheme = {
				type = antagonize_council_scheme
				target_character = scope:recipient
			}
		}
		scope:recipient = { 
			NOT = { 
				has_strong_hook = scope:actor 
				has_opinion_modifier = {target = scope:actor modifier = antagonize_council_opinion}
			} 
			is_ruler = yes
		}
		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 = antagonize_council_scheme
						target_character = scope:recipient
					}
				}
			}
			desc = scheme_interaction_tt_antagonize_council_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_antagonize_council_interaction.tt.agent_focus_balance
	}
	## Focused on Success Chance.
	send_option = {
		flag = agent_focus_success
		current_description = start_antagonize_council_interaction.tt.agent_focus_success
	}
	## Focused on Speed.
	send_option = {
		flag = agent_focus_speed
		current_description = start_antagonize_council_interaction.tt.agent_focus_speed
	}
	## Focused on Secrecy.
	send_option = {
		flag = agent_focus_secrecy
		current_description = start_antagonize_council_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
			}
		}
		scope:actor = {
			send_interface_toast = {
				type = event_toast_effect_neutral
				title = start_antagonize_council_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 = antagonize_council_scheme
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
						# Success.
						AGENT_1 = agent_poet
						AGENT_2 = agent_shill
						AGENT_3 = agent_shill
						# Speed.
						AGENT_4 = agent_planner
						# Secrecy.
						AGENT_5 = agent_lookout
					}
				}
				# Speed.
				else_if = {
					limit = { scope:agent_focus_speed ?= yes }
					begin_scheme_with_agents_effect = {
						SCHEME_TYPE = antagonize_council_scheme
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
						# Success.
						AGENT_1 = agent_poet
						# Speed.
						AGENT_2 = agent_planner
						AGENT_3 = agent_planner
						AGENT_4 = agent_socialite
						# Secrecy.
						AGENT_5 = agent_lookout
					}
				}
				# Secrecy.
				else_if = {
					limit = { scope:agent_focus_secrecy ?= yes }
					begin_scheme_with_agents_effect = {
						SCHEME_TYPE = antagonize_council_scheme
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
						# Success.
						AGENT_1 = agent_poet
						# Speed.
						AGENT_2 = agent_planner
						# Secrecy.
						AGENT_3 = agent_alibi
						AGENT_4 = agent_lookout
						AGENT_5 = agent_lookout
					}
				}
				# Balanced.
				else = {
					begin_scheme_with_agents_effect = {
						SCHEME_TYPE = antagonize_council_scheme
						TARGET_TYPE = target_character
						TARGET_SCOPE = scope:recipient
						# Success.
						AGENT_1 = agent_shill
						AGENT_2 = agent_poet
						# Speed.
						AGENT_3 = agent_socialite
						AGENT_4 = agent_planner
						# Secrecy.
						AGENT_5 = agent_lookout
					}
				}
			}
		}
	}
	
	auto_accept = yes
	ai_targets = {
		ai_recipients = liege
		ai_recipients = vassals
	}

	ai_targets = {
		ai_recipients = neighboring_rulers
		ai_recipients = peer_vassals
		max = 10
	}
	ai_frequency = 60

	ai_potential = {
		is_adult = yes
		ai_greed >= low_positive_ai_value
		intrigue >= medium_skill_rating
		NOR = {
			has_trait = content
			any_scheme = {
				OR = {
					scheme_type = murder
					scheme_type = abduct
					scheme_type = claim_throne
					scheme_type = fabricate_hook
					scheme_type = steal_back_artifact
				}
			}
		}
	}

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

		#High Opinion
		modifier = {
			add = -50
			
			opinion = {
				target = scope:recipient
				value >= high_positive_opinion
			}
		}
		#Hates liege
		modifier = {
			add = 50
			
			scope:recipient = {
				liege = scope:actor.liege
				liege = {
					OR = {
						has_relation_rival = scope:actor
						has_relation_nemesis = scope:actor
					}
				}
			}
		}
		# Traits.
		## Disloyal.
		modifier = {
			add = 50
			has_trait = disloyal
		}
		## Ambitious.
		modifier = {
			add = 50
			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
		}
		## Loyal.
		modifier = {
			add = -100
			has_trait = loyal
		}
	}
}


