namespace = qyv_personality

# Yearly: nudge opinions & spawn friendships/rivalries from personality overlaps/clashes
character_event = {
	id = qyv_personality.0001
	hidden = yes
	trigger = { is_ruler = yes }

	immediate = {
		# Sample peers
		random_vassal = { save_scope_as = peer1 }
		random_vassal = { save_scope_as = peer2 }

		# Apply soft opinion nudges
		if = { limit = { exists = scope:peer1 } target:other_character = scope:peer1 qyv_apply_personality_opinions = yes }
		if = { limit = { exists = scope:peer2 } target:other_character = scope:peer2 qyv_apply_personality_opinions = yes }

		# Small chance to formalize as friend/rival
		if = {
			limit = { exists = scope:peer1 qyv_personality_affinity = yes }
			random = { chance = 10 add_relation = { target = scope:peer1 relation = friends } }
		}
		if = {
			limit = { exists = scope:peer2 qyv_personality_clash = yes }
			random = { chance = 10 add_relation = { target = scope:peer2 relation = rival } }
		}
	}
}
