﻿courtly = {
	score = {
		value = ai_sociability
		add = {
			value = ai_sociability
			divide = 2
		}
		add = {
			value = ai_greed
			multiply = -1
		}
		add = {
			value = ai_compassion
			divide = 2
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = fickle
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = honest
			}
			add = 50
		}
		if = {
			limit = {
				culture = { has_cultural_pillar = ethos_courtly }
			}
			add = 50
		}
		if = {
			limit = {
				scope:liege = { has_royal_court = yes has_court_type = court_diplomatic }
			}
			add = 30
		}
		if = {
			limit = {
				scope:liege = { has_royal_court = yes has_court_type = court_intrigue }
			}
			add = 15
		}
		if = {
			limit = {
				top_participant_group:dynastic_cycle ?= {
					participant_group_type = pro_hegemon_movement
				}
			}
			add = 250
		}
		# [MTXXX]
		if = {
			limit = {
				MTXXX_liege_flouts_council_faith_tradition_trigger = { LIEGE = liege }
			}

			add = 20
		}
		# [/MTXXX]
		if = {
			limit = {
				culture = {
					has_innovation = innovation_royal_prerogative
				}
			}
			multiply = 1.2
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_heraldry
				}
			}
			multiply = 1.2
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_court_officials
				}
			}
			multiply = 1.2
		}
	}
	heir_score = {
		value = diplomacy
		multiply = 30
		add = ai_sociability
		add = ai_compassion
		add = {
			value = ai_greed
			multiply = -1
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = generous
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = greedy
			}
			add = -50
		}
		if = {
			limit = {
				has_trait = shy
			}
			add = -50
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_adult = no
			}
			multiply = 0.01
			add = -100
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_only_law
				}
			}
			multiply = 0
			add = -100
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_only_law
				}
			}
			multiply = 0
			add = -100
		}
	}	
	is_valid = {
		is_lowborn = no
		scope:liege = {
			is_landed = yes
		}
	}
}

glory_hound = {
	score = {
		value = ai_boldness
		add = {
			value = ai_compassion
			multiply = -1
		}
		add = {
			value = ai_honor
			multiply = -1
			divide = 2
		}
		if = {
			limit = {
				has_trait = brave
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = ambitious
			}
			add = 50
		}
		if = {
			limit = {
				scope:liege = { has_royal_court = yes has_court_type = court_warlike }
			}
			add = 30
		}
		if = {
			limit = {
				scope:liege = { has_royal_court = yes has_court_type = court_intrigue }
			}
			add = 15
		}
		if = {
			limit = {
				top_participant_group:dynastic_cycle ?= {
					participant_group_type = conservative_movement
				}
			}
			add = 250
		}
		# [MTXXX]
		if = {
			limit = {
				MTXXX_liege_flouts_council_faith_tradition_trigger = { LIEGE = liege }
			}

			add = 10
		}
		# [/MTXXX]
		if = {
			limit = {
				culture = {
					has_innovation = innovation_baliffs
				}
			}
			multiply = 1.2
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_knighthood
				}
			}
			multiply = 1.2
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_rightful_ownership
				}
			}
			multiply = 1.2
		}
	}
	heir_score = {
		value = martial
		multiply = 20
		add = ai_boldness
		if = {
			limit = {
				has_trait = brave
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = arrogant
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = craven
			}
			add = -500
		}
		if = {
			limit = {
				has_trait = shy
			}
			add = -50
		}
		if = {
			limit = {
				has_trait = content
			}
			add = -50
		}
		if = {
			limit = {
				culture = { has_cultural_pillar = ethos_bellicose }
			}
			add = 25
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_adult = no
			}
			multiply = 0.01
			add = -100
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_only_law
				}
			}
			multiply = 0
			add = -100
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_only_law
				}
			}
			multiply = 0
			add = -100
		}
	}
	is_valid = {
		scope:liege = {
			is_landed = yes
		}
	}	
}

parochial = {
	score = {
		value = ai_honor
		add = {
			value = ai_sociability
			multiply = -1
		}
		add = {
			value = ai_boldness
			multiply = -1
		}
		add = {
			value = ai_rationality
			divide = 2
		}
		if = {
			limit = {
				has_trait = content
			}
			add = 50
		}
		if = {
			limit = {
				culture = { has_cultural_pillar = ethos_communal }
			}
			add = 25
		}
		if = {
			limit = {
				government_has_flag = government_is_republic
			}
			add = 150
		}
		if = {
			limit = {
				culture = { has_cultural_tradition = tradition_isolationist }
			}
			add = 50
		}
		if = {
			limit = {
				scope:liege = { has_royal_court = yes has_court_type = court_administrative }
			}
			add = 30
		}
		if = {
			limit = {
				top_participant_group:dynastic_cycle ?= {
					participant_group_type = advancement_movement
				}
			}
			add = 250
		}
		# [MTXXX]
		if = {
			limit = {
				MTXXX_liege_flouts_council_faith_tradition_trigger = { LIEGE = liege }
			}

			add = 15
		}
		# [/MTXXX]
		if = {
			limit = {
				culture = {
					has_innovation = innovation_manorialism
				}
			}
			multiply = 1.2
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_land_grants
				}
			}
			multiply = 1.2
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_development_04
				}
			}
			multiply = 1.2
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_double_entry_bookkeeping
				}
			}
			multiply = 1.2
		}
		if = {
			limit = {
				culture = {
					has_cultural_parameter = more_parochial_vassals
				}
			}
			multiply = 1.2
		}
	}
	heir_score = {
		value = stewardship
		multiply = 20
		add = ai_honor
		add = ai_rationality
		if = {
			limit = {
				has_trait = content
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = stubborn
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = ambitious
			}
			add = -50
		}
		if = {
			limit = {
				has_trait = gregarious
			}
			add = -50
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_adult = no
			}
			multiply = 0.01
			add = -100
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_only_law
				}
			}
			multiply = 0
			add = -100
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_only_law
				}
			}
			multiply = 0
			add = -100
		}
	}
	is_valid = {
		scope:liege = {
			is_landed = yes
		}
	}	
}

zealot = {
	score = {
		value = ai_zeal
		add = {
			value = ai_zeal
			divide = 2
		}
		add = {
			value = ai_vengefulness
			divide = 2
		}
		if = {
			limit = {
				has_trait = zealous
			}
			add = 100
		}
		if = {
			limit = {
				has_trait = humble
			}
			add = 100
		}
		if = {
			limit = {
				has_trait = education_learning
			}
			add = 50
		}
		if = {
			limit = {
				has_focus = learning_theology_focus
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = trusting
			}
			add = 25
		}
		if = {
			limit = {
				has_trait = cynical
			}
			add = -50
		}
		if = {
			limit = {
				is_clergy = yes
			}
			add = 150
		}
		# [MTXXX]
		if = {
			limit = {
				MTXXX_liege_flouts_council_faith_tradition_trigger = { LIEGE = liege }
			}

			add = -20
		}
		# [/MTXXX]
		if = {
			limit = {
				num_sinful_traits >= 1
			}
			add = {
				value = -50
				multiply = num_sinful_traits
			}
		}
		if = {
			limit = {
				num_virtuous_traits >= 1
			}
			add = {
				value = 25
				multiply = num_virtuous_traits
			}
		}
		if = {
			limit = {
				culture = { has_cultural_tradition = tradition_zealous_people }
			}
			add = 50
		}
		if = {
			limit = {
				culture = { has_cultural_pillar = ethos_spiritual }
			}
			add = 25
		}
		if = {
			limit = {
				scope:liege = { has_royal_court = yes has_court_type = court_scholarly }
			}
			add = 30
		}
		if = {
			limit = {
				num_sinful_traits <= 0
				faith = { has_doctrine_parameter = more_often_zealots }
			}
			add = 400
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_chronicle_writing
				}
			}
			multiply = 1.2
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_reconquista
				}
			}
			multiply = 1.2
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_divine_right
				}
			}
			multiply = 1.2
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_primogeniture
				}
			}
			multiply = 1.2
		}
		if = {
			limit = {
				ai_zeal >= 0
				government_has_flag = government_is_theocracy
			}
			add = 2000
		}
		if = {
			limit = {
				NOR = {
					faith = scope:liege.faith
					faith = {
						faith_hostility_level = {
							target = scope:liege.faith
							value = faith_fully_accepted_level
						}
					}
				}
			}
			multiply = 0
			add = -5000
		}
	}
	heir_score = {
		value = learning
		multiply = 20
		add = ai_zeal
		if = {
			limit = {
				has_trait = humble
			}
			add = 100
		}
		if = {
			limit = {
				has_trait = zealous
			}
			add = 500
		}
		if = {
			limit = {
				num_virtuous_traits >= 1
			}
			add = {
				value = 100
				multiply = num_virtuous_traits
			}
		}
		if = {
			limit = {
				num_sinful_traits >= 1
			}
			add = {
				value = -200
				multiply = num_sinful_traits
			}
		}
		if = {
			limit = {
				NOR = {
					faith = scope:liege.faith
					faith = {
						faith_hostility_level = {
							target = scope:liege.faith
							value > faith_astray_level
						}
					}
				}
			}
			multiply = 0
			add = -5000
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_adult = no
			}
			multiply = 0.01
			add = -100
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_only_law
				}
			}
			multiply = 0
			add = -100
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_only_law
				}
			}
			multiply = 0
			add = -100
		}
	}
	is_valid = {
		OR = {
			faith = scope:liege.faith
			faith = {
				faith_hostility_level = {
					target = scope:liege.faith
					value = faith_fully_accepted_level
				}
			}
		}
		scope:liege = {
			is_landed = yes
		}
	}	
}

minority = {
	score = 1000
	heir_score = {
		value = ai_honor
		add = ai_compassion
		if = {
			limit = {
				OR = {
					AND = {
						faith != scope:liege.faith
						faith = {
							faith_hostility_level = {
								target = scope:liege.faith
								value > faith_astray_level
							}
						}
						NOR = {
							AND = {
								scope:liege.faith.religion = religion:islam_religion
								faith = {
									has_doctrine = tenet_islamic_syncretism
								}
							}
							AND = {
								scope:liege.faith.religion = religion:judaism_religion
								faith = {
									has_doctrine = tenet_jewish_syncretism
								}
							}
							AND = {
								scope:liege.faith.religion = religion:christianity_religion
								faith = {
									has_doctrine = tenet_christian_syncretism
								}
							}
							AND = {
								scope:liege.faith = {
									has_doctrine_parameter = unreformed
								}
								faith = {
									has_doctrine = tenet_unreformed_syncretism
								}
							}
						}
					}
					AND = {
						culture != scope:liege.culture
						OR = {
						culture = {
							cultural_acceptance = { target = scope:liege.culture value < 30 }
						}
							AND = {
								any_character_struggle = {
									involvement = involved
									has_struggle_phase_parameter = struggle_different_culture_more_likely_to_use_minority_stance
								}
								culture = {
									cultural_acceptance = { target = scope:liege.culture value < 70 }
								}
							}
						}
					}
				}
			}
			add = 1000
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_adult = no
			}
			multiply = 0.01
			add = -100
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_only_law
				}
			}
			multiply = 0
			add = -100
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_only_law
				}
			}
			multiply = 0
			add = -100
		}
	}
	is_valid = {
		NAND = {
			is_clergy = yes
			faith = scope:liege.faith
		}
		NOR = {
			culture = { has_cultural_tradition = tradition_loyal_soldiers }
			culture = { has_cultural_tradition = tradition_fp2_malleable_subjects }
		}
		OR = {
			AND = {
				faith != scope:liege.faith
				faith = {
					faith_hostility_level = {
						target = scope:liege.faith
						value > faith_astray_level
					}
				}
				NOR = {
					AND = {
						scope:liege.faith.religion = religion:islam_religion
						faith = {
							has_doctrine = tenet_islamic_syncretism
						}
					}
					AND = {
						scope:liege.faith.religion = religion:judaism_religion
						faith = {
							has_doctrine = tenet_jewish_syncretism
						}
					}
					AND = {
						scope:liege.faith.religion = religion:christianity_religion
						faith = {
							has_doctrine = tenet_christian_syncretism
						}
					}
					AND = {
						scope:liege.faith = {
							has_doctrine_parameter = unreformed
						}
						faith = {
							has_doctrine = tenet_unreformed_syncretism
						}
					}
				}
			}
			AND = {
				scope:liege = {
					NOT = { has_trait = crusader_king } #First generation of crusader vassals will not prioritize their cultural rights.
				}
				culture != scope:liege.culture
				OR = {
				culture = {
					cultural_acceptance = { target = scope:liege.culture value < 30 }
				}
					AND = {
						any_character_struggle = {
							involvement = involved
							has_struggle_phase_parameter = struggle_different_culture_more_likely_to_use_minority_stance
			}
						culture = {
							cultural_acceptance = { target = scope:liege.culture value < 70 }
						}
					}
				}
			}
		}
		scope:liege = {
			is_landed = yes
		}
	}
}

barons_and_minor_landholders = {
	score = {
		value = 0
		if = {
			limit = {
				highest_held_title_tier = tier_barony
			}
			add = 1000
		}
	}
	heir_score = {
		value = ai_compassion
		add = {
			value = ai_greed
			multiply = -2
		}
		if = {
			limit = {
				OR = {
					NOR = {
						faith = scope:liege.faith
						faith = {
							faith_hostility_level = {
								target = scope:liege.faith
								value >= faith_astray_level
							}
						}
					}
					NOR = {
						culture = scope:liege.culture
						culture = {
							cultural_acceptance = { target = scope:liege.culture value >= 30 }
						}
					}
				}
			}
			add = 1000
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_adult = no
			}
			multiply = 0.01
			add = -100
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_only_law
				}
			}
			multiply = 0
			add = -100
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_only_law
				}
			}
			multiply = 0
			add = -100
		}
	}	
	is_valid = {
		highest_held_title_tier = tier_barony
		scope:liege = {
			is_landed = yes
		}
	}
}

belligerent = {
	score = {
		value = ai_boldness
		add = {
			value = ai_vengefulness
			divide = 2
		}
		add = {
			value = ai_compassion
			multiply = -2
		}
		add = {
			value = ai_honor
			divide = 2
		}
		if = {
			limit = {
				has_trait = wrathful
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = ambitious
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = vengeful
			}
			add = 50
		}
		if = {
			limit = {
				culture = { has_cultural_pillar = ethos_bellicose }
			}
			add = 50
		}
		if = {
			limit = {
				scope:liege = { has_royal_court = yes has_court_type = court_warlike }
			}
			add = 30
		}
		if = {
			limit = {
				scope:liege = { has_royal_court = yes has_court_type = court_tribal }
			}
			add = 15
		}
		if = {
			limit = {
				government_has_flag = government_is_nomadic
			}
			add = 150
		}
		if = {
			limit = {
				top_participant_group:dynastic_cycle ?= {
					participant_group_type = expansion_movement
				}
			}
			add = 250
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_standing_armies
				}
			}
			multiply = 1.2
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_all_things
				}
			}
			multiply = 1.1
		}
	}
	heir_score = {
		value = prowess
		multiply = 30
		add = ai_boldness
		add = ai_vengefulness
		add = ai_honor
		add = {
			value = ai_compassion
			multiply = -1
		}
		if = {
			limit = {
				has_trait = wrathful
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = ambitious
			}
			add = 50
		}
		if = {
			limit = {
				has_trait = craven
			}
			add = -50
		}
		if = {
			limit = {
				has_trait = humble
			}
			add = -50
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_preference_law
				}
			}
			multiply = 0.01
		}
		if = {
			limit = {
				is_adult = no
			}
			multiply = 0.01
			add = -100
		}
		if = {
			limit = {
				is_male = yes
				scope:liege = {
					has_realm_law = female_only_law
				}
			}
			multiply = 0
			add = -100
		}
		if = {
			limit = {
				is_female = yes
				scope:liege = {
					has_realm_law = male_only_law
				}
			}
			multiply = 0
			add = -100
		}
	}	
	is_valid = {
		is_lowborn = no
		scope:liege = {
			is_landed = yes
		}
	}
}
