﻿#Accuse of violating sumptuary laws
#by James Beaumont

sumptuary_law_debate_interaction = {
	category = interaction_category_hostile
	interface_priority = 20
	desc = sumptuary_law_debate_interaction_desc
	icon = weaver_inspiration

	is_shown = {
		scope:actor = {
			has_royal_court = yes
			has_dlc_feature = royal_court
			amenity_level = {
				type = court_fashion
				value <= 2
			}
		}
		NOT = { scope:actor = scope:recipient }
		scope:recipient = {
			# Character is either not a priest/zealous class of a naked priest faith or doesn't belong to a naked priest faith
			OR = {
				faith = { NOT = { has_doctrine_parameter = naked_priests_active } }
				NOR = {
					ai_zeal >= 50
					has_trait = devoted
					has_trait = zealous
					government_has_flag = government_is_theocracy
					has_council_position = councillor_court_chaplain
				}
			}
			# They are in your realm to some capacity
			OR = {
				liege = scope:actor	#You may debate with direct vassals and courtiers.
				host = scope:actor #You may debate guests
			}
		}
	}

	is_valid_showing_failures_only = {
		scope:actor = {
			is_adult = yes
		}
		scope:recipient = {
			# Friends don't accuse friends of fashion crimes
			NOT = {
				has_friendly_relationship_with_character_trigger = {
					CHARACTER = scope:actor
				}
			}
		}
		custom_description = {
			text = sumptuary_debate_has_been_debated
			object = scope:recipient
			scope:recipient = {
				NOT = { has_character_modifier = used_sumptuary_debate_modifier } #To prevent back and forth & back-to-back challenges
				NOT = { has_character_modifier = sumptuary_debated_modifier }
			}
		}
		custom_description = {
			text = sumptuary_debate_timing
			scope:actor = {
				NOT = { has_character_modifier = used_sumptuary_debate_modifier }
			}
		}
		scope:recipient = {
			is_adult = yes
		}
		scope:recipient = {
			NOT = { has_strong_hook = scope:actor }
		}
		scope:recipient = { is_busy_in_events_localised = yes }
		scope:actor = {
			NOT = {
				is_at_war_with = scope:recipient
			}
		}
	}

	auto_accept = yes

	on_accept = {
		hidden_effect = {
			scope:actor = {
				add_character_modifier = {
					modifier = used_sumptuary_debate_modifier
					years = 2
				}
			}
			scope:recipient = {
				trigger_event = {
					id = court_amenities_interactions.0001
					days = 1
				}
				add_character_modifier = {
					modifier = sumptuary_debated_modifier
					years = 10
				}
			}
		}
		custom_tooltip = sumptuary_debate_interaction.tt_modifiers
		scope:actor = {
			stress_impact = {
				arbitrary = minor_stress_impact_loss
				just = minor_stress_impact_gain
			}
			custom_tooltip = sumptuary_debate_interaction.tt_winnings_actor
		}
		scope:recipient = {
			custom_tooltip = sumptuary_debate_interaction.tt_winnings_recipient
		}

		# If we're a clan this interaction affects unity
		add_clan_unity_interaction_effect = {
			CHARACTER = scope:actor
			TARGET = scope:recipient
			VALUE = medium_unity_loss
			DESC = clan_unity_sumptuary_law.desc
			REVERSE_NON_HOUSE_TARGET = no
		}
	}
}
