﻿
gpt_negotiate_merc = {
	icon = administration
	category = interaction_category_diplomacy
 	common_interaction = yes
	interface_priority = 100

	desc = gpt_negotiate_merc_desc

	cooldown_against_recipient = { years = 10 }

	is_shown = {
		NOT = { has_game_rule = GPT_rfavor_disabled }
		NOT = { scope:recipient = scope:actor }
		
		scope:actor = {
			is_ai = no
			highest_held_title_tier >= 2
			any_hired_mercenary = {
				mercenary_company_leader = scope:recipient
			}
		}

		scope:recipient = {
			primary_title = { is_mercenary_company = yes }
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			is_adult = yes
			is_imprisoned = no
			is_at_war = no
			is_independent_ruler = yes
			prestige > 0
			prestige_level > 0
		}
	}

	send_option = {
		is_shown = {
			exists = scope:recipient
		}
		is_valid = {
			scope:actor = {
				prestige > 0
			}
		}
		flag = confront_gold
		localization = SCHEME_AGENT_PRESTIGE
	}

	send_option = {
		is_valid = {
			scope:actor = {
				has_usable_hook = scope:recipient
			}
		}
		flag = confront_hook
		localization = SCHEME_HOOK
	}
	should_use_extra_icon = {
		scope:actor = { has_usable_hook = scope:recipient }
	}
	extra_icon = "gfx/interface/icons/character_interactions/hook_icon.dds"

	send_options_exclusive = no

	on_accept = {
		scope:actor = {
			add_stress = 10
			stress_impact = {
				craven = 5
				patient = 5
				calm = 5
			}
			stress_impact = {
				wrathful = -5
				vengeful = -5
				callous = -5
			}
		}
		scope:recipient = {
			save_scope_as = saved_mercenary
			custom_tooltip = gpt_recipient_negotiate_tt
		}
		scope:actor = {
			if = {
				limit = {
					ai_boldness >= 20
				}
				custom_tooltip = gpt_bold_negotiate_tt
				hidden_effect = {
					random_list = {
						33 = { trigger_event = gpt_negotiate.0007 }
						33 = { trigger_event = gpt_negotiate.0008 }
						33 = { trigger_event = gpt_negotiate.0009 }
					}
				}
			}
			else_if = {
				limit = {
					ai_boldness > -20
					ai_boldness < 20
				}
				custom_tooltip = gpt_neutral_negotiate_tt
				hidden_effect = {
					random_list = {
						33 = { trigger_event = gpt_negotiate.0004 }
						33 = { trigger_event = gpt_negotiate.0005 }
						33 = { trigger_event = gpt_negotiate.0006 }
					}
				}
			}
			else_if = {
				limit = {
					ai_boldness <= -20
				}
				custom_tooltip = gpt_craven_negotiate_tt
				hidden_effect = {
					random_list = {
						33 = { trigger_event = gpt_negotiate.0001 }
						33 = { trigger_event = gpt_negotiate.0002 }
						33 = { trigger_event = gpt_negotiate.0003 }
					}
				}
			}
			else = { }
		}

		if = {
			limit = { always = scope:confront_gold }
			scope:actor = {
				add_character_flag = { flag = gpt_confront_gift days = 5 }
				add_prestige = gpt_merc_strenght_value_neg
				custom_tooltip = gpt_gold_negotiate_tt
				stress_impact = {
					greedy = minor_stress_impact_gain
				}
			}
			scope:recipient = {
				add_prestige = gpt_merc_strenght_value_pos
			}
		}
		if = {
			limit = { always = scope:confront_hook }
			scope:actor = {
				add_character_flag = { flag = gpt_confront_hook days = 5 }
				use_hook = scope:recipient
				custom_tooltip = gpt_hook_negotiate_tt
			}
		}
	}

	cost = {
	}
	
	ai_will_do = {
		base = 0 #The AI should never do this!
	}

	auto_accept = yes
}