﻿elector_voting_pattern_traits_compeditae_elective_modifier = {
	##########################	Elector voting patterns (traits)	##########################
	#Personality Traits compatibility
	#Sins vs Virtues
	#Crime traits
	#Attraction (including sexual traits)
	#Special cases (ex. deformities, disfigured for Byzantines)

	#Trait compatibility between elector and candidate
	compatibility_modifier = {
		who = root
		compatibility_target = scope:candidate
		min = -50
		max = 50
		trigger = {
			NOT = { root = scope:candidate }
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_sinful
		NOT = { this = scope:candidate } #Do not judge yourself.
		NOT = { has_trait = cynical }
		ai_zeal > 0
		scope:candidate = { num_sinful_traits >= 1 }
		add = {
			subtract = 5
			if = { #Check specific number...
				limit = {
					scope:candidate = { num_sinful_traits >= 2 }
				}
				subtract = 5
			}
			if = { #Check specific number...
				limit = {
					scope:candidate = { num_sinful_traits >= 3 }
				}
				subtract = 5
			}
			if = { #Check specific number...
				limit = {
					scope:candidate = { num_sinful_traits >= 4 }
				}
				subtract = 5
			}
			if = { #Check specific number...
				limit = {
					scope:candidate = { num_sinful_traits >= 5 }
				}
				subtract = 5
			}
			if = { #Princely elective more unforgiving.
				limit = {
					scope:title = { has_title_law = princely_elective_succession_law }
				}
				multiply = 2
			}
			multiply = ai_zeal #...Multiply by Elector Zeal.
			multiply = 0.1 #Reduce overall to avoid extreme numbers.
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_virtuous
		NOR = {
			this = scope:candidate	#Do not judge yourself.
			has_trait = cynical
		}
		ai_zeal > 0
		scope:candidate = { num_virtuous_traits >= 1 }
		add = {
			add = 5
			if = { #Check specific number...
				limit = {
					scope:candidate = { num_virtuous_traits >= 2 }
				}
				add = 5
			}
			if = { #Check specific number...
				limit = {
					scope:candidate = { num_virtuous_traits >= 3 }
				}
				add = 5
			}
			if = { #Check specific number...
				limit = {
					scope:candidate = { num_virtuous_traits >= 4 }
				}
				add = 5
			}
			if = { #Check specific number...
				limit = {
					scope:candidate = { num_virtuous_traits >= 5 }
				}
				add = 5
			}
			if = { #Princely elective more unforgiving.
				limit = {
					scope:title = { has_title_law = princely_elective_succession_law }
				}
				multiply = 2
			}
			multiply = ai_zeal #...Multiply by Elector Zeal.
			multiply = 0.1 #Reduce overall to avoid extreme numbers.
		}
	}
	#Excommunication
	modifier = {
		desc = tooltip_feudal_elector_vote_excommunication
		NOT = { this = scope:candidate } #Do not judge yourself.
		faith = { has_doctrine_parameter = excommunication_active }
		faith = scope:candidate.faith
		root.faith.religious_head = scope:candidate.faith.religious_head #Must have been excommunicated by the same Pope.
		OR = {
			NOT = { has_trait = excommunicated }
			has_trait = arbitrary #No need for consistency
		}
		scope:candidate = { has_trait = excommunicated }
		add = {
			subtract = 25
			if = { #Religious gradients.
				limit = { ai_zeal > 0 }
				subtract = {
					value = ai_zeal
					multiply = 0.5
				}
			}
			if = { #Princely Elective doubles.
				limit = {
					scope:title = { has_title_law = princely_elective_succession_law }
				}
				multiply = 2
			}
		}
	}
	#Kinslayer Crime
	modifier = {
		desc = tooltip_feudal_elector_vote_kinslayer
		NOR = {
			this = scope:candidate	#Do not judge yourself.
			faith = { has_doctrine = doctrine_kinslaying_accepted }
		}
		OR = {
			NOT = { has_trait = kinslayer }
			has_trait = arbitrary #No need for consistency
		}
		scope:candidate = { has_trait = kinslayer }
		add = {
			value = 0
			if = { #Check specific trait, multiply depending on religious doctrine.
				limit = {
					scope:candidate = { has_trait = kinslayer_1 }
				}
				subtract = 10
				if = {
					limit = {
						faith = { has_doctrine = doctrine_kinslaying_any_dynasty_member_crime }
					}
					multiply = 2
				}
			}
			else_if = {
				limit = {
					scope:candidate = { has_trait = kinslayer_2 }
				}
				subtract = 15
				if = {
					limit = {
						faith = {
							OR = {
								has_doctrine = doctrine_kinslaying_any_dynasty_member_crime
								has_doctrine = doctrine_kinslaying_extended_family_crime
							}
						}
					}
					multiply = 2
				}
			}
			else_if = {
				limit = {
					scope:candidate = { has_trait = kinslayer_3 }
				}
				subtract = 20
				if = {
					limit = {
						faith = {
							OR = {
								has_doctrine = doctrine_kinslaying_any_dynasty_member_crime
								has_doctrine = doctrine_kinslaying_extended_family_crime
								has_doctrine = doctrine_kinslaying_close_kin_crime
							}
						}
					}
					multiply = 2
				}
			}
			#And further add malus depending on Elector's relation to the Kinslaying candidate.
			if = {
				limit = {
					exists = scope:candidate.dynasty
					NOT = { dynasty = scope:candidate.dynasty }
				}
				subtract = 10
			}
			else_if = {
				limit = {
					exists = scope:candidate.dynasty
					dynasty = scope:candidate.dynasty
					NOT = { is_close_family_of = scope:candidate }
				}
				subtract = 20
			}
			else_if = {
				limit = {
					exists = scope:candidate.dynasty
					dynasty = scope:candidate.dynasty
					is_close_family_of = scope:candidate
				}
				subtract = 30
			}
			if = { #Boost for Scandinavian Elective.
				limit = {
					scope:title = { has_title_law = scandinavian_elective_succession_law }
				}
				multiply = 1.5
			}
		}
	}

	#Deviancy
	modifier = {
		desc = tooltip_feudal_elector_vote_deviant
		NOT = {
			this = scope:candidate	#Do not judge yourself.
			faith = { has_doctrine = doctrine_deviancy_accepted }
		}
		OR = {
			NOT = { has_trait = deviant }
			has_trait = arbitrary #No need for consistency
		}
		scope:candidate = { has_trait = deviant }
		add = 15
	}
	#Cannibalism
	modifier = {
		desc = tooltip_feudal_elector_vote_cannibal
		NOR = {
			this = scope:candidate	#Do not judge yourself.
			faith = { has_doctrine_parameter = cannibalism_legal }
		}
		OR = {
			NOT = { has_trait = cannibal }
			has_trait = arbitrary #No need for consistency
		}
		scope:candidate = { has_trait = cannibal }
		add = {
			subtract = 30
			if = { #Religious gradients.
				limit = { ai_zeal > 10 }
				subtract = {
					value = ai_zeal
					multiply = 0.5
				}
			}
		}
	}
	#Attraction
	modifier = {
		desc = tooltip_feudal_elector_vote_attractive
		NOT = { this = scope:candidate } #Do not judge yourself, you dirty AI.
		is_adult = yes
		scope:candidate = {
			is_adult = yes
			attraction >= 25
		}
		add = {
			value = 1
			multiply = scope:candidate.attraction
			multiply = 0.2
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_ugly
		NOT = { this = scope:candidate } #Do not judge yourself.
		is_adult = yes
		scope:candidate = {
			is_adult = yes
			attraction <= -25
		}
		add = {
			value = 0
			multiply = scope:candidate.attraction
			multiply = 0.2
		}
	}
	#Fertility
	modifier = {
		desc = tooltip_compeditae_elector_vote_fertility
		NOT = { this = scope:candidate }
		is_adult = yes
		scope:candidate = {
			is_adult = yes
		}
		add = {
			value = 0
			if = {
				limit = {
					scope:candidate = { fertility >= 0.5 }
				}
				add = 5
			}
			if = {
				limit = {
					scope:candidate = { fertility >= 0.7 }
				}
				add = 5
			}
			if = {
				limit = {
					scope:candidate = { fertility >= 0.9 }
				}
				add = 5
			}
		}
	}
	#Multitasker
	modifier = {
		desc = tooltip_compeditae_elector_vote_multitasker
		NOT = { this = scope:candidate }
		is_adult = yes
		scope:candidate = {
			has_trait = regula_multitasker_bloodline
		}
		add = {
			value = 25
		}
	}
	#Health
	modifier = {
		desc = tooltip_compeditae_elector_vote_health
		NOT = { this = scope:candidate }
		is_adult = yes
		scope:candidate = {
			is_adult = yes
		}
		add = {
			value = 0
			if = {
				limit = {
					scope:candidate = { health <= 2 }
				}
				add = -50
			}
			if = {
				limit = {
					scope:candidate = { health >= 3 }
				}
				add = 5
			}
			if = {
				limit = {
					scope:candidate = { health >= 5 }
				}
				add = 10
			}
			if = {
				limit = {
					scope:candidate = { health >= 7 }
				}
				add = 10
			}
		}
	}
	#Bloodline
	modifier = {
		desc = tooltip_compeditae_elector_vote_pure_blooded
		NOT = { this = scope:candidate } #Do not judge yourself.
		scope:candidate = {
			has_trait = pure_blooded
		}
		add = {
			value = 100
		}
	}
	#Obligatory sex characteristics
	# Big dick
	# modifier = {
	# 	desc = tooltip_compeditae_elector_vote_dick_big
	# 	NOT = { this = scope:candidate } #Do not judge yourself.
	# 	scope:candidate = {
	# 		OR = {
	# 			has_trait = dick_big
	# 		}
	# 	}
	# 	add = {
	# 		add = 10
	# 		if = {
	# 			limit = {
	# 				scope:candidate = { has_trait = dick_big_1 }
	# 			}
	# 			add = 5
	# 		}
	# 		if = {
	# 			limit = {
	# 				scope:candidate = {
	# 					OR = {
	# 						has_trait = dick_big_2
	# 					}
	# 				}
	# 			}
	# 			add = 10
	# 		}
	# 		if = {
	# 			limit = {
	# 				scope:candidate = { has_trait = dick_big_3 }
	# 			}
	# 			add = 15
	# 		}
	# 	}
	# }
	# Small dick
	# modifier = {
	# 	desc = tooltip_compeditae_elector_vote_dick_small
	# 	NOT = { this = scope:candidate } #Do not judge yourself.
	# 	scope:candidate = {
	# 		OR = {
	# 			has_trait = dick_small
	# 		}
	# 	}
	# 	add = {
	# 		subtract = 10
	# 		if = {
	# 			limit = {
	# 				scope:candidate = { has_trait = dick_small_1 }
	# 			}
	# 			subtract = 5
	# 		}
	# 		if = {
	# 			limit = {
	# 				scope:candidate = {
	# 					OR = {
	# 						has_trait = dick_small_2
	# 					}
	# 				}
	# 			}
	# 			subtract = 10
	# 		}
	# 		if = {
	# 			limit = {
	# 				scope:candidate = { has_trait = dick_small_3 }
	# 			}
	# 			subtract = 15
	# 		}
	# 	}
	# }

	#Special cases (ex. deformities, disfigured for Byzantines)
	modifier = {
		add = -35
		desc = tooltip_feudal_elector_vote_incapable
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = no
		scope:candidate = { has_trait = incapable }
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_incapable_warrior
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = yes
		scope:candidate = { has_trait = incapable }
		add = {
			subtract = 50
			if = { #Scandinavian elective more unforgiving.
				limit = {
					scope:title = { has_title_law = scandinavian_elective_succession_law }
				}
				multiply = 2
			}
		}
	}
	modifier = {
		add = -15
		desc = tooltip_feudal_elector_vote_infirm
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_diplomatic_society_trigger = no
		scope:candidate = { has_trait = infirm }
	}
	modifier = {
		add = -30
		desc = tooltip_feudal_elector_vote_infirm_diplomat
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_diplomatic_society_trigger = yes
		scope:candidate = { has_trait = infirm }
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_disfigured
		this_is_martial_society_trigger = no
		scope:candidate = { has_trait = disfigured }
		add = -15
	}
	modifier = {
		add = -10
		desc = tooltip_feudal_elector_vote_maimed
		this_is_martial_society_trigger = no
		scope:candidate = { has_trait = maimed }
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_maimed_warrior
		this_is_martial_society_trigger = yes
		scope:candidate = { has_trait = maimed }
		add = {
			subtract = 15
			if = { #Scandinavian elective more unforgiving.
				limit = {
					scope:title = { has_title_law = scandinavian_elective_succession_law }
				}
				multiply = 2
			}
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_genius_diplomat
		NOT = { this = scope:candidate } #Do not judge yourself.
		OR = {
			this_is_diplomatic_society_trigger = yes
			this_is_spiritual_society_trigger = yes
		}
		scope:candidate = {
			OR = {
				has_trait = intellect_good
				has_trait = shrewd
			}
		}
		add = {
			value = 10
			if = {
				limit = {
					scope:candidate = { has_trait = intellect_good_1 }
				}
				add = 5
			}
			if = {
				limit = {
					scope:candidate = {
						OR = {
							has_trait = intellect_good_2
							has_trait = shrewd
						}
					}
				}
				add = 10
			}
			if = {
				limit = {
					scope:candidate = { has_trait = intellect_good_3 }
				}
				add = 15
			}
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_genius
		NOT = { this = scope:candidate } #Do not judge yourself.
		NOR = {
			this_is_diplomatic_society_trigger = yes
			this_is_spiritual_society_trigger = yes
		}
		scope:candidate = {
			OR = {
				has_trait = intellect_good
				has_trait = shrewd
			}
		}
		add = {
			value = 0
			if = {
				limit = {
					scope:candidate = { has_trait = intellect_good_1 }
				}
				add = 5
			}
			if = {
				limit = {
					scope:candidate = {
						OR = {
							has_trait = intellect_good_2
							has_trait = shrewd
						}
					}
				}
				add = 10
			}
			if = {
				limit = {
					scope:candidate = { has_trait = intellect_good_3 }
				}
				add = 15
			}
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_strong
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = no
		scope:candidate = {
			OR = {
				has_trait = physique_good
				has_trait = strong
			}
		}
		add = {
			value = 0
			if = {
				limit = {
					scope:candidate = { has_trait = physique_good_1 }
				}
				add = 5
			}
			if = {
				limit = {
					scope:candidate = {
						OR = {
							has_trait = strong
							has_trait = physique_good_2
						}
					}
				}
				add = 10
			}
			if = {
				limit = {
					scope:candidate = { has_trait = physique_good_3 }
				}
				add = 15
			}
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_strong_warrior
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = yes
		scope:candidate = {
			OR = {
				has_trait = physique_good
				has_trait = strong
			}
		}
		add = {
			value = 10
			if = {
				limit = {
					scope:candidate = { has_trait = physique_good_1 }
				}
				add = 5
			}
			if = {
				limit = {
					scope:candidate = {
						OR = {
							has_trait = strong
							has_trait = physique_good_2
						}
					}
				}
				add = 10
			}
			if = {
				limit = {
					scope:candidate = { has_trait = physique_good_3 }
				}
				add = 15
			}
			if = { #Scandinavian elective more unforgiving.
				limit = {
					scope:title = { has_title_law = scandinavian_elective_succession_law }
				}
				multiply = 2
			}
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_imbecile
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_diplomatic_society_trigger = no
		scope:candidate = {
			OR = {
				has_trait = intellect_bad
				has_trait = dull
			}
		}
		add = {
			value = 0
			if = {
				limit = {
					scope:candidate = { has_trait = intellect_bad_1 }
				}
				subtract = 5
			}
			if = {
				limit = {
					scope:candidate = {
						OR = {
							has_trait = intellect_bad_2
							has_trait = dull
						}
					}
				}
				subtract = 10
			}
			if = {
				limit = {
					scope:candidate = { has_trait = intellect_bad_3 }
				}
				subtract = 15
			}
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_imbecile_diplomat
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_diplomatic_society_trigger = yes
		scope:candidate = {
			OR = {
				has_trait = intellect_bad
				has_trait = dull
			}
		}
		add = {
			subtract = 10
			if = {
				limit = {
					scope:candidate = { has_trait = intellect_bad_1 }
				}
				subtract = 5
			}
			if = {
				limit = {
					scope:candidate = {
						OR = {
							has_trait = intellect_bad_2
							has_trait = dull
						}
					}
				}
				subtract = 10
			}
			if = {
				limit = {
					scope:candidate = { has_trait = intellect_bad_3 }
				}
				subtract = 15
			}
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_clubfooted
		NOT = { this = scope:candidate } #Do not judge yourself.
		scope:candidate = { has_trait = clubfooted }
		add = {
			subtract = 5
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_dwarf
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = no
		scope:candidate = { has_trait = dwarf }
		add = {
			subtract = 15
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_dwarf_warrior
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = yes
		scope:candidate = { has_trait = dwarf }
		add = {
			subtract = 30
			if = { #Scandinavian elective more unforgiving.
				limit = {
					scope:title = { has_title_law = scandinavian_elective_succession_law }
				}
				multiply = 2
			}
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_hunchback
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = no
		scope:candidate = {has_trait = hunchbacked }
		add = {
			subtract = 15
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_hunchback_warrior
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = yes
		scope:candidate = { has_trait = hunchbacked }
		add = {
			subtract = 30
			if = { #Scandinavian elective more unforgiving.
				limit = {
					scope:title = { has_title_law = scandinavian_elective_succession_law }
				}
				multiply = 2
			}
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_inbred
		NOT = { this = scope:candidate } #Do not judge yourself.
		scope:candidate = {
			OR = {
				has_trait = inbred
				has_trait = spindly
				has_trait = scaly
				has_trait = albino
				has_trait = wheezing
				has_trait = bleeder
			}
		}
		add = {
			subtract = 100
		}
	}
	modifier = {
		desc = tooltip_feudal_elector_vote_lisping
		NOT = { this = scope:candidate } #Do not judge yourself.
		scope:candidate = { has_trait = lisping }
		add = {
			subtract = 5
		}
	}
	modifier = {
		add = -5
		desc = tooltip_feudal_elector_vote_stuttering
		NOT = { this = scope:candidate } #Do not judge yourself.
		scope:candidate = { has_trait = stuttering }
	}
	modifier = { #Shunned for being a lunatic
		add = -5
		desc = tooltip_feudal_elector_vote_lunatic_negative
		NOT = { this = scope:candidate } #Do not judge yourself.
		OR = {
			has_trait = arbitrary #No need for consistency
			NOR = {
				has_trait = lunatic
				has_trait = possessed
			}
		}
		scope:candidate = { has_trait = lunatic }
	}
	modifier = { #Shunned for being possessed
		add = -15
		desc = tooltip_feudal_elector_vote_possessed_negative
		NOR = {
			this = scope:candidate	#Do not judge yourself.
			faith = { has_doctrine_parameter = spirit_possession_active }
		}
		OR = {
			has_trait = arbitrary #No need for consistency
			NOR = {
				has_trait = lunatic
				has_trait = possessed
			}
		}
		scope:candidate = { has_trait = possessed }
	}
	modifier = { #Praised for being possessed
		add = 35
		desc = tooltip_feudal_elector_vote_possessed_positive
		NOT = { this = scope:candidate } #Do not judge yourself.
		faith = { has_doctrine_parameter = spirit_possession_active }
		ai_zeal > 10
		scope:candidate = { has_trait = possessed }
	}
	modifier = { #Praised for being Pilgrim
		add = 10
		desc = tooltip_feudal_elector_vote_pilgrim_positive
		NOT = { this = scope:candidate } #Do not judge yourself.
		faith = scope:candidate.faith
		ai_zeal > 10
		scope:candidate = { has_trait = pilgrim }
	}
	modifier = { #Praised for being Crusader
		add = 10
		desc = tooltip_feudal_elector_vote_crusader_positive
		NOT = { this = scope:candidate } #Do not judge yourself.
		faith = scope:candidate.faith
		ai_zeal > 10
		scope:candidate = { has_trait = faith_warrior }
	}
	modifier = { #Shunned for being Crusader
		add = -15
		desc = tooltip_feudal_elector_vote_crusader_negative
		NOR = {
			this = scope:candidate	#Do not judge yourself.
			faith = scope:candidate.faith
		}
		faith = {
			faith_hostility_level = {
				target = scope:candidate.faith
				value >= faith_hostile_level
			}
		}
		ai_zeal > 10
		scope:candidate = { has_trait = faith_warrior }
	}
	modifier = { #Praised for being a saoshyant_descendant
		add = 10
		desc = tooltip_feudal_elector_vote_saoshyant_descendant_positive
		NOT = { this = scope:candidate } #Do not judge yourself.
		faith = { religion_tag = zoroastrianism_religion }
		scope:candidate = { has_trait = saoshyant_descendant }
	}
	modifier = { #Praised for being Adventurer
		add = 10
		desc = tooltip_feudal_elector_vote_adventurer_positive
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = yes
		scope:candidate = { has_trait = adventurer }
	}
	modifier = { #Shunned for being Adventurer
		add = -10
		desc = tooltip_feudal_elector_vote_adventurer_negative
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = no
		scope:candidate = { has_trait = adventurer }
	}
	modifier = { #Praised for being Berserker
		add = 5
		desc = tooltip_feudal_elector_vote_berserker_positive
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = yes
		scope:candidate = { has_trait = berserker }
	}
	modifier = { #Shunned for being Berserker
		add = -20
		desc = tooltip_feudal_elector_vote_berserker_negative
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = no
		scope:candidate = { has_trait = berserker }
	}
	modifier = { #Shunned for being blind
		desc = tooltip_feudal_elector_vote_blinded_negative
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = no
		scope:candidate = { has_trait = blind }
		add = {
			subtract = 10
		}
	}
	modifier = { #Shunned for being blind
		desc = tooltip_feudal_elector_vote_blinded_negative_warrior
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = yes
		scope:candidate = { has_trait = blind }
		add = {
			subtract = 20
			if = { #Scandinavian elective more unforgiving.
				limit = {
					scope:title = { has_title_law = scandinavian_elective_succession_law }
				}
				multiply = 2
			}
		}
	}
	modifier = { #Shunned for being eunuch
		desc = tooltip_feudal_elector_vote_eunuch_negative
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = no
		scope:candidate = {has_trait = eunuch }
		add = -40
	}
	modifier = { #Shunned for being eunuch
		desc = tooltip_feudal_elector_vote_eunuch_negative_warrior
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = yes
		scope:candidate = {has_trait = eunuch }
		add = -60
	}
	modifier = { #Shunned for being eunuch
		desc = tooltip_feudal_elector_vote_eunuch_negative_byzantine
		NOT = { this = scope:candidate } #Do not judge yourself.
		scope:candidate = { has_trait = eunuch }
		add = -150
	}
	modifier = { #Praised for being Giant
		add = 10
		desc = tooltip_feudal_elector_vote_giant_positive
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = yes
		scope:candidate = { has_trait = giant }
	}
	modifier = { #Shunned for being Giant
		add = -10
		desc = tooltip_feudal_elector_vote_giant_negative
		NOT = { this = scope:candidate } #Do not judge yourself.
		this_is_martial_society_trigger = no
		scope:candidate = { has_trait = giant }
	}
	modifier = { #Shunned for being unproved courtier in the shadow of the ruler.
		add = -10
		desc = tooltip_feudal_elector_vote_spoiled_courtier
		scope:candidate = { this = scope:holder_candidate }
		NOT = { this = scope:candidate } #Do not judge yourself.
		scope:candidate = {
			NOR = {
				is_ruler = yes
				has_council_position = councillor_marshal
				has_council_position = councillor_chancellor
				has_council_position = councillor_steward
				has_council_position = councillor_spymaster
				has_council_position = councillor_court_chaplain
			}
			OR = {
				has_trait = deviant
				has_trait = lazy
				has_trait = lifestyle_reveler
				has_trait = seducer
				has_trait = drunkard
				has_trait = shy
			}
		}
	}
}


elector_voting_pattern_opinion_compeditae_elective_modifier = {
	##########################	Elector voting patterns (opinion)	##########################
	#Ruler is lunatic, vote against his pick
	modifier = {
		add = -10
		desc = tooltip_feudal_elector_anti_vote_ruler_lunatic
		scope:candidate = { this = scope:holder_candidate }
		NOR = {
			this = scope:candidate	#But not if it's me.
			has_trait = lunatic #Don't care
			has_trait = possessed #Don't care
			has_trait = arbitrary #Don't care
			has_trait = zealous #Might be the gods speaking
			faith = { has_doctrine_parameter = spirit_possession_active } #Actually blessed
		}
		scope:holder = {
			has_trait = lunatic
		}
	}
	#Ruler is possessed, vote against his pick
	modifier = {
		add = -10
		desc = tooltip_feudal_elector_anti_vote_ruler_possessed
		scope:candidate = { this = scope:holder_candidate }
		ai_zeal > 0
		NOR = {
			this = scope:candidate	#But not if it's me.
			has_trait = lunatic #Don't care
			has_trait = possessed #Don't care
			has_trait = arbitrary #Don't care
			faith = { has_doctrine_parameter = spirit_possession_active } #Actually blessed
		}
		scope:holder = {
			has_trait = possessed
		}
	}
	#Unless adorcism is a thing
	modifier = {
		add = 25
		desc = tooltip_feudal_elector_anti_vote_ruler_possessed_positive
		scope:candidate = { this = scope:holder_candidate }
		faith = { has_doctrine_parameter = spirit_possession_active } #Actually blessed
		ai_zeal > 0
		scope:holder = {
			has_trait = possessed
		}
	}
	#Ruler is just, trust his pick
	modifier = {
		desc = tooltip_feudal_elector_pro_vote_ruler_just
		scope:candidate = { this = scope:holder_candidate }
		NOR = {
			this = scope:holder  #But not if it's me.
			this = scope:candidate  #But not if it's me.
		}
		NOR = {
			has_trait = lunatic #Don't care
			has_trait = possessed #Don't care
			has_trait = arbitrary #Don't like it
			has_trait = sadistic #Don't care
			faith = { trait_is_sin = just } #Not a positive.
		}
		scope:holder = { has_trait = just }
		add = {
			value = 25
			if = {
				limit = {
					faith = { has_doctrine_parameter = legalism_trust_just_leader_active }
				}
				add = 15
			}
		}
	}
	#Ruler is a Tyrant, vote against his pick
	modifier = {
		desc = tooltip_feudal_elector_anti_vote_ruler_tyrant
		scope:candidate = { this = scope:holder_candidate }
		NOR = {
			this = scope:holder  #But not if it's me.
			this = scope:candidate  #But not if it's me.
		}
		NOR = {
			has_trait = lunatic #Don't care
			has_trait = possessed #Don't care
			has_trait = arbitrary #Don't care
			has_trait = sadistic #Don't care
			has_trait = callous #Don't care
		}
		scope:holder = {
			tyranny >= low_tyranny
		}
		add = {
			subtract = 25
			if = {
				limit = {
					tyranny >= medium_tyranny
				}
				subtract = 25
			}
			if = {
				limit = {
					tyranny >= high_tyranny
				}
				subtract = 50
			}
		}
	}
	#Ruler is Dreaded, vote for his pick
	modifier = {
		desc = tooltip_feudal_elector_anti_vote_ruler_dreaded
		scope:candidate = { this = scope:holder_candidate }
		NOR = {
			this = scope:holder  #But not if it's me.
			this = scope:candidate  #But not if it's me.
		}
		NOR = {
			has_trait = lunatic #Don't care
			has_trait = arbitrary #Don't care
		}
		scope:holder = { dread >= low_dread	}
		dread_modified_ai_boldness = {
			dreaded_character = scope:holder
			value <= -25
		}
		add = {
			value = 0
			if = {
				limit = {
					dread_modified_ai_boldness = {
						dreaded_character = scope:holder
						value <= -50
					}
				}
				add = 5
			}
			if = {
				limit = {
					dread_modified_ai_boldness = {
						dreaded_character = scope:holder
						value <= -75
					}
				}
				add = 10
			}
			if = {
				limit = {
					dread_modified_ai_boldness = {
						dreaded_character = scope:holder
						value <= -95
					}
				}
				add = 15
			}
		}
	}
	##########################	Raw Opinion bonus towards Candidate	##########################
	modifier = { #Raw Opinion bonus (negative)
		desc = tooltip_feudal_elector_vote_opinion_negative
		NOT = { this = scope:candidate } #Not on yourself.
		save_temporary_opinion_value_as = {
			name = opinion_of_candidate
			target = scope:candidate
		}
		scope:opinion_of_candidate <= low_negative_opinion
		add = {
			subtract = 15
			if = { #Even less so if lower opinion.
				limit = {
					scope:opinion_of_candidate <= medium_negative_opinion
				}
				subtract = 15 #-30 total
			}
			if = { #Even less so if lower opinion.
				limit = {
					scope:opinion_of_candidate <= high_negative_opinion
				}
				subtract = 20 #-50 total
			}
			if = { #Even less so if lower opinion.
				limit = {
					scope:opinion_of_candidate <= very_high_negative_opinion
				}
				subtract = 50 #-100 total
			}
			if = { #Even less so if rival.
				limit = {
					has_relation_rival = scope:candidate
				}
				subtract = 50 #-150 total
			}
			if = { #Further increased for Tanistry.
				limit = {
					scope:title = { has_title_law = gaelic_elective_succession_law }
				}
				multiply = 1.5
			}
		}
	}
	modifier = { #Raw Opinion bonus (positive)
		desc = tooltip_feudal_elector_vote_opinion_positive
		NOT = {
			has_relation_rival = scope:candidate #Completely removed for rivals.
		}
		NOT = { this = scope:candidate } #Not on yourself.
		save_temporary_opinion_value_as = {
			name = opinion_of_candidate
			target = scope:candidate
		}
		scope:opinion_of_candidate >= low_positive_opinion
		add = {
			value = 15
			if = { #Even more so if higher opinion.
				limit = {
					scope:opinion_of_candidate >= medium_positive_opinion
				}
				add = 15 #30 total
			}
			if = { #Even more so if higher opinion.
				limit = {
					scope:opinion_of_candidate >= high_positive_opinion
				}
				add = 20 #50 total
			}
			if = { #Even more so if higher opinion.
				limit = {
					scope:opinion_of_candidate >= very_high_positive_opinion
				}
				add = 20 #70 total
			}
			if = { #Even more so if friend/lover.
				limit = {
					OR = {
						has_relation_friend = scope:candidate
						has_relation_lover = scope:candidate
					}
				}
				add = 30 #100 total
			}
			if = { #Further increased for Tanistry.
				limit = {
					scope:title = { has_title_law = gaelic_elective_succession_law }
				}
				multiply = 1.5
			}
		}
	}
	##########################	Raw Opinion bonus towards Ruler	##########################
	modifier = { #Vassal hates ruler, therefore votes against the ruler's candidate (scope:holder_candidate)
		desc = tooltip_feudal_elector_anti_vote_ruler_opinion_negative
		scope:candidate = scope:holder_candidate
		NOR = {
			this = scope:holder  #But not if it's me.
			this = scope:candidate  #But not if it's me.
		}
		save_temporary_opinion_value_as = {
			name = opinion_of_holder
			target = scope:holder
		}
		scope:opinion_of_holder <= low_negative_opinion
		add = {
			subtract = 10
			if = { #Even less so if lower opinion.
				limit = {
					scope:opinion_of_holder <= medium_negative_opinion
				}
				subtract = 15 #-25 total
			}
			if = { #Even less so if lower opinion.
				limit = {
					scope:opinion_of_holder <= high_negative_opinion
				}
				subtract = 25 #-50 total
			}
			if = { #Even less so if lower opinion.
				limit = {
					scope:opinion_of_holder <= very_high_negative_opinion
				}
				subtract = 50 #-100 total
			}
			if = { #Even less so if rival.
				limit = {
					has_relation_rival = scope:holder
				}
				subtract = 50 #-150 total
			}
		}
	}
	# modifier = { #Vassal loves ruler, therefore votes for the ruler's candidate (scope:holder_candidate)
	# 	desc = tooltip_feudal_elector_pro_vote_ruler_opinion_positive
	# 	scope:candidate = scope:holder_candidate
	# 	NOR = {
	# 		this = scope:holder  #But not if it's me.
	# 		this = scope:candidate  #But not if it's me.
	# 	}
	# 	save_temporary_opinion_value_as = {
	# 		name = opinion_of_holder
	# 		target = scope:holder
	# 	}
	# 	scope:opinion_of_holder >= low_positive_opinion
	# 	add = {
	# 		value = 0
	# 		# if = { #Even more so if higher opinion.
	# 		# 	limit = {
	# 		# 		opinion = {
	# 		# 			target = scope:holder
	# 		# 			value >= medium_positive_opinion
	# 		# 		}
	# 		# 	}
	# 		# 	add = 5 #5 total
	# 		# }
	# 		# if = { #Even more so if higher opinion.
	# 		# 	limit = {
	# 		# 		opinion = {
	# 		# 			target = scope:holder
	# 		# 			value >= high_positive_opinion
	# 		# 		}
	# 		# 	}
	# 		# 	add = 10 #15 total
	# 		# }
	# 		# if = { #Even more so if higher opinion.
	# 		# 	limit = {
	# 		# 		opinion = {
	# 		# 			target = scope:holder
	# 		# 			value >= very_high_positive_opinion
	# 		# 		}
	# 		# 	}
	# 		# 	add = 25 #50 total
	# 		# }
	# 		if = { #Even more so if friend/lover.
	# 			limit = {
	# 				OR = {
	# 					has_relation_friend = scope:holder
	# 					has_relation_lover = scope:holder
	# 				}
	# 			}
	# 			add = 50 #100 total
	# 		}
	# 	}
	# }

	modifier = { #Vassal obeys the Magister.
		desc = tooltip_compeditae_elector_pro_vote_magister_level
		scope:candidate = scope:holder_candidate
		NOR = {
			this = scope:holder  #But not if it's me.
			this = scope:candidate  #But not if it's me.
		}
		add = {
			value = 0
			if = {
				limit = {
					global_var:magister_character = {
						has_trait = magister_1
					}
				}
				add = -25 #Malus if the magister is disgraced.
			}
			if = {
				limit = {
					global_var:magister_character = {
						has_trait = magister_2
					}
				}
				add = 0
			}
			if = {
				limit = {
					global_var:magister_character = {
						has_trait = magister_3
					}
				}
				add = 15
			}
			if = {
				limit = {
					global_var:magister_character = {
						has_trait = magister_4
					}
				}
				add = 30
			}
			if = {
				limit = {
					global_var:magister_character = {
						has_trait = magister_5
					}
				}
				add = 50
			}
			if = {
				limit = {
					global_var:magister_character = {
						has_trait = magister_6
					}
				}
				add = 100
			}
		}
	}

	modifier = { # Magisters candidate is his child
		desc = tooltip_compeditae_elector_pro_vote_magister_child
		scope:candidate = scope:holder_candidate
		NOR = {
			this = scope:holder  #But not if it's me.
			this = scope:candidate  #But not if it's me.
		}
		scope:candidate = {
			OR = {
				is_grandchild_of = global_var:magister_character
				is_child_of = global_var:magister_character
			}
		}
		add = {
			value = 0
			if = {
				limit = {
					scope:candidate = {
						is_child_of = global_var:magister_character
					}
				}
				add = 75
			}
			else_if = {
				limit = {
					scope:candidate = {
						is_grandchild_of = global_var:magister_character
					}
				}
				add = 50
			}
		}
	}
}
