﻿proclaim_nobility_interaction = {
	category = interaction_category_friendly
	common_interaction = yes
	desc = proclaim_nobility_interaction.desc
	interface_priority = 80
	auto_accept = no
	ai_frequency = 0
	
	is_shown = {
		scope:actor = {
		    OR = {
			NOT = { 
				has_character_flag = illiterate 
			} 
			 is_landed = yes
			}
			dynasty = { has_dynasty_modifier = lowborn_modifier } 
		}
	   scope:recipient = scope:actor.liege_or_court_owner
	}
	
	is_valid_showing_failures_only = {
		NOT = {
		   scope:actor = {
			has_trait = slave
			has_trait = bastard
		  }
		}
	   
	  custom_tooltip = {
	   text = proclaim_nobility_interaction.tt1
		scope:actor = { is_courtier = yes }
		scope:recipient = scope:actor.liege
	  }
	}
	can_send = {
		scope:actor = {
			is_ai = no
		}
	}
	send_option = {
		flag = gold_option
		is_valid = {
			scope:actor.gold >= 250
		}
		localization = laamp_to_ladmin_gold_option_desc
	}
	send_options_exclusive = no
	cost = {
		gold = {
			add = {
				value = 150
				desc = BASE
			}
			if = {
				limit = { scope:gold_option = yes }
				add = {
					value = 100
					desc = laamp_to_ladmin_gold_option_desc
				}
			}
		}
		prestige = 200}
	
	ai_accept = {
		base = -10 # Try to make it 0 for most interactions

		opinion_modifier = { # Opinion Factor
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 0.1
			desc = AI_OPINION_REASON
		}
		modifier = {
			add = -10
			desc = PROCURE_ESTATE_GALLOWSBAIT_REASON
			scope:actor = {
				has_trait = gallowsbait
			}
		}
		#DIFFERENT FAITH FROM STATE FAITH (if recipient is state faith)
		modifier = {
			add = -5
			desc = PROCURE_ESTATE_STATE_FAITH_REASON
			scope:actor.faith = {
				NOT = {
					this = scope:recipient.top_liege.primary_title.state_faith
				}
			}
			scope:recipient.faith = {
				this = scope:recipient.top_liege.primary_title.state_faith
			}
			NOT = {
				scope:piety_option = yes
			}
		}
		#Hey you're actually a local in my capital
		modifier = {
			add = 10
			desc = PROCURE_ESTATE_SAME_CULTURE_AS_CAPITAL_REASON
			scope:recipient.capital_county.culture = {
				this = scope:actor.culture
			}
		}
		#You have a criminal background
		modifier = {
			add = -5
			desc = PROCURE_ESTATE_GALLOWSBAIT_REASON
			scope:actor = {
				has_trait = gallowsbait
				NOR = {
					has_trait_xp = {
						trait = gallowsbait
						track = bandit
						value < 40
					}
					has_trait_xp = {
						trait = gallowsbait
						track = trickster
						value < 40
					}
					has_trait_xp = {
						trait = gallowsbait
						track = thief
						value < 40
					}
					has_trait_xp = {
						trait = gallowsbait
						track = poacher
						value < 40
					}
					has_trait_xp = {
						trait = gallowsbait
						track = marauder
						value < 40
					}
				}
			}
		}
		modifier = {
			add = -20
			desc = PROCURE_ESTATE_GALLOWSBAIT_REASON
			scope:actor = {
				has_trait = gallowsbait
				OR = {
					has_trait_xp = {
						trait = gallowsbait
						track = bandit
						value >= 40
					}
					has_trait_xp = {
						trait = gallowsbait
						track = trickster
						value >= 40
					}
					has_trait_xp = {
						trait = gallowsbait
						track = thief
						value >= 40
					}
					has_trait_xp = {
						trait = gallowsbait
						track = poacher
						value >= 40
					}
					has_trait_xp = {
						trait = gallowsbait
						track = marauder
						value >= 40
					}
				}
				NOR = {
					has_trait_xp = {
						trait = gallowsbait
						track = bandit
						value < 80
					}
					has_trait_xp = {
						trait = gallowsbait
						track = trickster
						value < 80
					}
					has_trait_xp = {
						trait = gallowsbait
						track = thief
						value < 80
					}
					has_trait_xp = {
						trait = gallowsbait
						track = poacher
						value < 80
					}
					has_trait_xp = {
						trait = gallowsbait
						track = marauder
						value < 80
					}
				}
			}
		}
		modifier = {
			add = -50
			desc = PROCURE_ESTATE_GALLOWSBAIT_REASON
			scope:actor = {
				has_trait = gallowsbait
				OR = {
					has_trait_xp = {
						trait = gallowsbait
						track = bandit
						value >= 80
					}
					has_trait_xp = {
						trait = gallowsbait
						track = trickster
						value >= 80
					}
					has_trait_xp = {
						trait = gallowsbait
						track = thief
						value >= 80
					}
					has_trait_xp = {
						trait = gallowsbait
						track = poacher
						value >= 80
					}
					has_trait_xp = {
						trait = gallowsbait
						track = marauder
						value >= 80
					}
				}
			}
		}
		#Needs gold
		modifier = {
			add = 20
			
				scope:gold_option = yes
			
			desc = PROCURE_ESTATE_NEEDS_GOLD_REASON
		}
	}
	
	on_accept = {
		scope:actor = { trigger_event = rtr.0016 }
		custom_tooltip = proclaim_nobility_interaction.tt
	}
}
