###################### # Legitimacy ###################### # Tier 1-4 legitimacy_title_tier_value = { # County = 1 # Duchy = 2 # Kingdom = 3 # Empire = 4 value = highest_held_title_tier subtract = 1 min = 1 } # Era 1-4 legitimacy_era_value = { # Tribal = 1 # Early = 2 # High = 3 # Late = 4 value = 1 culture ?= { if = { limit = { has_cultural_era_or_later = culture_era_early_medieval } add = 1 } if = { limit = { has_cultural_era_or_later = culture_era_high_medieval } add = 1 } if = { limit = { has_cultural_era_or_later = culture_era_late_medieval } add = 1 } } min = 1 } # Combined Era + Tier 1-8 legitimacy_title_era_value = { value = 0 add = legitimacy_era_value # 1-4 add = legitimacy_title_tier_value # 1-4 min = 2 # 1 per era, 1 per title } # Tier Values # These must be kept as simple as possible for performance's sake legitimacy_level_1 = 0 # Gap of at least 60 legitimacy_level_2 = { # 60-240 value = 30 multiply = legitimacy_title_era_value } # Gap of at least 80 legitimacy_level_3 = { # 140-560 value = 70 multiply = legitimacy_title_era_value } # Gap of at least 100 legitimacy_level_4 = { # 240-960 value = 120 multiply = legitimacy_title_era_value } # Gap of at least 160 legitimacy_level_5 = { # 400-1600 value = 200 multiply = legitimacy_title_era_value } # Gap of at least 200 legitimacy_level_6 = { # 600-2400 value = 300 multiply = legitimacy_title_era_value } legitimacy_max = { # 690-2760 value = legitimacy_level_6 multiply = 1.15 round_to = 100 } ### GAIN/LOSS VALUES miniscule_legitimacy_gain = 20 minor_legitimacy_gain = 50 medium_legitimacy_gain = 100 major_legitimacy_gain = 200 massive_legitimacy_gain = 300 miniscule_legitimacy_loss = { value = 0 subtract = miniscule_legitimacy_gain } minor_legitimacy_loss = { value = 0 subtract = minor_legitimacy_gain } medium_legitimacy_loss = { value = 0 subtract = medium_legitimacy_gain } major_legitimacy_loss = { value = 0 subtract = major_legitimacy_gain } massive_legitimacy_loss = { value = 0 subtract = massive_legitimacy_gain } ### BASE CALCULATION VALUES # COURT GRANDEUR base_legitimacy_per_court_grandeur_level_value = 30 # DYNASTY RENOWN base_legitimacy_per_dynasty_prestige_level_value = 50 # DYNASTY PERKS base_legitimacy_per_legitimacy_track_perk_value = 50 # DYNASTY OF PREDECESSOR base_legitimacy_dynasty_of_previous_value = 100 # RELATION TO PREDECESSOR succession_legitimacy_ancestor_per_tier_value = 50 base_legitimacy_predecessor_primary_heir_value = 30 base_legitimacy_predecessor_child_value = 25 base_legitimacy_predecessor_close_family_value = 20 base_legitimacy_predecessor_spouse_value = 15 base_legitimacy_predecessor_extended_family_value = 10 # SEX base_legitimacy_sidelined_sex_value = -15 # BASTARDRY base_legitimacy_bastardry_high_value = -50 base_legitimacy_bastardry_medium_value = -25 base_legitimacy_bastardry_low_value = -10 # YEARS AS RULER base_legitimacy_per_year_as_ruler_value = 20 # SPECIAL TRAITS base_legitimacy_per_special_traits_value = 50 # Base legitimacy calculation - used for game start and in code # root - ruler that gets legitimacy base_legitimacy_value = { # Split into separate values for easy debugging/visibility value = 0 # TIER add = base_legitimacy_tier_value # COURT GRANDEUR add = base_legitimacy_court_grandeur_value # DYNASTY RENOWN add = base_legitimacy_dynasty_prestige_level_value # LEGITIMACY BLOODLINE DYNASTY PERKS add = base_legitimacy_track_perks_value # COUNTY OPINION - derived from average of held counties add = base_legitimacy_county_opinion_value # PREVIOUS HOLDER DYNASTY add = base_legitimacy_dynasty_of_predecessor_value # PREVIOUS HOLDER CHILD add = base_legitimacy_relation_to_predecessor_value # SIDELINED SEX add = base_legitimacy_sex_value # BASTARDRY add = base_legitimacy_bastardry_value # YEARS AS RULER - bonus for startup rulers add = base_legitimacy_years_as_ruler_value # SPECIAL TRAITS add = base_legitimacy_special_traits_value # DIPLOMACY SKILLS add = base_legitimacy_diplomacy_value # ADMINISTRATIVE if = { limit = { has_government = administrative_government } multiply = 0.75 # To reduce the overall base values add = base_legitimacy_admin_value # And add anything admin specific } min = 100 # No one starts with Level 0 round = yes } # SUCESSION LEGITIMACY CALCULATION - USED AS THE INITIAL LEGITIMACY OF NON GAME START CHARACTERS and in code # root - ruler that gets legitimacy succession_legitimacy_value = { # Split into separate values for easy debugging/visibility value = 0 # TIER add = base_legitimacy_tier_value # COURT GRANDEUR add = base_legitimacy_court_grandeur_value # DYNASTY RENOWN - new value to avoid Splendor bloating add = succession_legitimacy_dynasty_prestige_level_value # LEGITIMACY BLOODLINE DYNASTY PERKS add = base_legitimacy_track_perks_value # COUNTY OPINION - derived from average of held counties add = base_legitimacy_county_opinion_value # PREVIOUS HOLDER DYNASTY add = base_legitimacy_dynasty_of_predecessor_value # WHO WAS YOUR PARENT add = succession_legitimacy_ancestor_tier_value # PREVIOUS HOLDER CHILD add = base_legitimacy_relation_to_predecessor_value # SIDELINED SEX add = base_legitimacy_sex_value # BASTARDRY add = base_legitimacy_bastardry_value # YEARS AS RULER - bonus for startup rulers add = base_legitimacy_years_as_ruler_value # SPECIAL TRAITS add = base_legitimacy_special_traits_value # DIPLOMACY SKILLS add = base_legitimacy_diplomacy_value # ADMINISTRATIVE if = { limit = { has_government = administrative_government } multiply = 0.75 # To reduce the overall base values add = base_legitimacy_admin_value # And add anything admin specific } min = 0 round = yes } # TIER base_legitimacy_tier_value = { value = 0 if = { limit = { highest_held_title_tier = tier_county } add = 0 } else_if = { limit = { highest_held_title_tier = tier_duchy } add = 50 } else_if = { limit = { highest_held_title_tier = tier_kingdom } add = 150 } else_if = { limit = { highest_held_title_tier = tier_empire } add = 400 } } # COURT GRANDEUR base_legitimacy_court_grandeur_value = { value = 0 if = { limit = { has_royal_court = yes has_dlc_feature = royal_court } if = { limit = { court_grandeur_current_level >= 9_levels_above_expected_level #you meet expectations } add = { value = base_legitimacy_per_court_grandeur_level_value multiply = 3 } } else_if = { limit = { court_grandeur_current_level >= 7_levels_above_expected_level } add = { value = base_legitimacy_per_court_grandeur_level_value multiply = 2 } } else_if = { limit = { court_grandeur_current_level >= 5_levels_above_expected_level } add = { value = base_legitimacy_per_court_grandeur_level_value multiply = 1.5 } } else_if = { limit = { court_grandeur_current_level >= 3_levels_above_expected_level } add = { value = base_legitimacy_per_court_grandeur_level_value multiply = 1.25 } } else_if = { limit = { court_grandeur_current_level >= 1_levels_above_expected_level } add = { value = base_legitimacy_per_court_grandeur_level_value } } else_if = { limit = { court_grandeur_current_level <= 1_levels_below_expected_level } subtract = base_legitimacy_per_court_grandeur_level_value } else_if = { limit = { court_grandeur_current_level <= 3_levels_below_expected_level } subtract = { value = base_legitimacy_per_court_grandeur_level_value multiply = 1.25 } } else_if = { limit = { court_grandeur_current_level <= 5_levels_below_expected_level } subtract = { value = base_legitimacy_per_court_grandeur_level_value multiply = 1.5 } } else_if = { limit = { court_grandeur_current_level <= 7_levels_below_expected_level } subtract = { value = base_legitimacy_per_court_grandeur_level_value multiply = 2 } } else_if = { limit = { court_grandeur_current_level <= 9_levels_below_expected_level } subtract = { value = base_legitimacy_per_court_grandeur_level_value multiply = 3 } } } } # DYNASTY RENOWN base_legitimacy_dynasty_prestige_level_value = { value = 0 if = { limit = { highest_held_title_tier = tier_county } add = { value = base_legitimacy_per_dynasty_prestige_level_value multiply = dynasty.dynasty_prestige_level } } else_if = { limit = { highest_held_title_tier = tier_duchy } add = { value = base_legitimacy_per_dynasty_prestige_level_value multiply = dynasty.dynasty_prestige_level multiply = 1.5 } } else_if = { limit = { highest_held_title_tier = tier_kingdom } add = { value = base_legitimacy_per_dynasty_prestige_level_value multiply = dynasty.dynasty_prestige_level multiply = 2 } } else_if = { limit = { highest_held_title_tier = tier_empire } add = { value = base_legitimacy_per_dynasty_prestige_level_value multiply = dynasty.dynasty_prestige_level multiply = 2.25 } } if = { # We lower everything if you're in 867 limit = { culture ?= { NOT = { has_cultural_era_or_later = culture_era_early_medieval } } } multiply = 0.5 } } succession_legitimacy_dynasty_prestige_level_value = { value = 0 if = { limit = { highest_held_title_tier = tier_county } add = { value = base_legitimacy_per_dynasty_prestige_level_value multiply = dynasty.dynasty_prestige_level multiply = 0.25 } } else_if = { limit = { highest_held_title_tier = tier_duchy } add = { value = base_legitimacy_per_dynasty_prestige_level_value multiply = dynasty.dynasty_prestige_level multiply = 0.5 } } else_if = { limit = { highest_held_title_tier = tier_kingdom } add = { value = base_legitimacy_per_dynasty_prestige_level_value multiply = dynasty.dynasty_prestige_level multiply = 0.75 } } else_if = { limit = { highest_held_title_tier = tier_empire } add = { value = base_legitimacy_per_dynasty_prestige_level_value multiply = dynasty.dynasty_prestige_level } } if = { # We lower everything if you're in 867 limit = { culture ?= { NOT = { has_cultural_era_or_later = culture_era_early_medieval } } } multiply = 0.5 } } # LEGITIMACY BLOODLINE DYNASTY PERKS base_legitimacy_track_perks_value = { value = 0 if = { limit = { dynasty.ce1_legitimacy_legacy_track_perks >= 1 } add = { value = base_legitimacy_per_legitimacy_track_perk_value multiply = dynasty.ce1_legitimacy_legacy_track_perks } } } # COUNTY OPINION base_legitimacy_county_opinion_value = { value = 0 if = { # Average of popular opinion in all held counties divided 4 (max 25) limit = { any_held_title = { tier = tier_county } } every_held_title = { limit = { tier = tier_county } add = { value = county_opinion multiply = 2 } } divide = base_legitimacy_county_opinion_county_count_value divide = 4 ceiling = yes } } base_legitimacy_county_opinion_county_count_value = { value = 0 if = { limit = { any_held_county = { tier = tier_county } } every_held_title = { limit = { tier = tier_county } add = 1 } } } # PREDECESSOR DYNASTY base_legitimacy_dynasty_of_predecessor_value = { value = 0 if = { limit = { primary_title.previous_holder.dynasty ?= dynasty } if = { limit = { highest_held_title_tier = tier_county } add = base_legitimacy_dynasty_of_previous_value } else_if = { limit = { highest_held_title_tier = tier_duchy } add = { value = base_legitimacy_dynasty_of_previous_value multiply = 1.5 } } else_if = { limit = { highest_held_title_tier = tier_kingdom } add = { value = base_legitimacy_dynasty_of_previous_value multiply = 2 } } else_if = { limit = { highest_held_title_tier = tier_empire } add = { value = base_legitimacy_dynasty_of_previous_value multiply = 2.25 } } # How many previous holders were of your same dynasty? primary_title = { every_past_holder = { limit = { dynasty ?= dynasty } add = { value = base_legitimacy_dynasty_of_previous_value multiply = 0.05 } } } if = { # We lower everything if you're in 867 limit = { culture ?= { NOT = { has_cultural_era_or_later = culture_era_early_medieval } } } multiply = 0.5 } } } # SUCCESSION - WHO WAS YOUR DAD/MOM succession_legitimacy_ancestor_tier_value = { value = 0 if = { limit = { any_parent = { is_ruler = yes highest_held_title_tier = tier_empire } } add = { value = succession_legitimacy_ancestor_per_tier_value multiply = 3 } } else_if = { limit = { any_parent = { is_ruler = yes highest_held_title_tier = tier_kingdom } } add = { value = succession_legitimacy_ancestor_per_tier_value multiply = 2 } } else_if = { limit = { any_parent = { is_ruler = yes highest_held_title_tier = tier_duchy } } add = { value = succession_legitimacy_ancestor_per_tier_value multiply = 1.5 } } else_if = { limit = { any_parent = { is_ruler = yes highest_held_title_tier = tier_county } } add = succession_legitimacy_ancestor_per_tier_value } if = { # We lower everything if you're in 867 limit = { culture ?= { NOT = { has_cultural_era_or_later = culture_era_early_medieval } } } multiply = 0.5 } } # RELATION TO PREDECESSOR base_legitimacy_relation_to_predecessor_value = { value = 0 if = { limit = { exists = primary_title.previous_holder } if = { limit = { is_primary_heir_of = primary_title.previous_holder } if = { limit = { highest_held_title_tier = tier_county } add = base_legitimacy_predecessor_primary_heir_value } else_if = { limit = { highest_held_title_tier = tier_duchy } add = { value = base_legitimacy_predecessor_primary_heir_value multiply = 1.5 } } else_if = { limit = { highest_held_title_tier = tier_kingdom } add = { value = base_legitimacy_predecessor_primary_heir_value multiply = 2 } } else_if = { limit = { highest_held_title_tier = tier_empire } add = { value = base_legitimacy_predecessor_primary_heir_value multiply = 2.25 } } if = { # We lower everything if you're in 867 limit = { culture ?= { NOT = { has_cultural_era_or_later = culture_era_early_medieval } } } multiply = 0.5 } } if = { limit = { is_child_of = primary_title.previous_holder } add = base_legitimacy_predecessor_child_value } else_if = { limit = { is_close_family_of = primary_title.previous_holder } add = base_legitimacy_predecessor_close_family_value } else_if = { limit = { is_spouse_of = primary_title.previous_holder } add = base_legitimacy_predecessor_spouse_value } else_if = { limit = { is_extended_family_of = primary_title.previous_holder } add = base_legitimacy_predecessor_extended_family_value } } } # SEX base_legitimacy_sex_value = { value = 0 if = { limit = { OR = { AND = { is_male = yes faith_dominant_gender_male_or_equal = no } AND = { is_female = yes faith_dominant_gender_female_or_equal = no } } } add = base_legitimacy_sidelined_sex_value } } # BASTARDRY base_legitimacy_bastardry_value = { value = 0 if = { limit = { has_trait = bastard } add = base_legitimacy_bastardry_high_value } if = { limit = { has_trait = disputed_heritage } add = base_legitimacy_bastardry_medium_value } if = { limit = { OR = { has_trait = legitimized_bastard has_trait = wild_oat has_trait = child_of_concubine } } add = base_legitimacy_bastardry_low_value } } # YEARS AS RULER base_legitimacy_years_as_ruler_value = { value = 0 ordered_held_title = { limit = { tier = prev.highest_held_title_tier } order_by = title_held_years add = title_held_years divide = 2 } ceiling = yes } # SPECIAL TRAITS base_legitimacy_special_traits_value = { value = 0 if = { limit = { has_trait = sayyid } add = { value = base_legitimacy_per_special_traits_value multiply = 2 } } if = { limit = { has_trait = born_in_the_purple } add = { value = base_legitimacy_per_special_traits_value multiply = 2 } } if = { limit = { has_trait = august } add = { value = base_legitimacy_per_special_traits_value multiply = 2 } } if = { limit = { has_trait = just } add = { value = base_legitimacy_per_special_traits_value multiply = 2 } } if = { limit = { num_virtuous_traits >= 1 } add = { value = base_legitimacy_per_special_traits_value multiply = num_virtuous_traits } } if = { limit = { num_sinful_traits >= 1 } add = { value = base_legitimacy_per_special_traits_value multiply = num_sinful_traits multiply = -1 } } if = { limit = { has_trait = inbred } add = { value = base_legitimacy_per_special_traits_value multiply = -2 } } } # DIPLOMACY SKILLS base_legitimacy_diplomacy_value = { value = 0 add = { value = diplomacy multiply = 2 #to make it matter } } # ADMINISTRATIVE base_legitimacy_admin_value = { value = 0 # Am I a dominant or powerful family? if = { limit = { house ?= { is_dominant_family = yes } } add = { value = house.house_power_score multiply = 1.5 round = yes } } else_if = { limit = { house ?= { is_powerful_family = yes } NOT = { primary_title.previous_holder.house ?= house } } add = { value = house.house_power_score } } # Am I allied to any other powerful families? if = { limit = { any_ally = { house ?= { house_head = prev is_powerful_family = yes } top_liege = root.top_liege } } every_ally = { limit = { house ?= { house_head = prev is_powerful_family = yes } top_liege = root.top_liege } add = { value = 10 multiply = influence_level } } } # What is my Level of Influence? if = { limit = { influence_level >= 2 } add = { value = 5 multiply = influence_level } } # What is the popular opinion in the capital? if = { limit = { capital_province.county = { county_opinion != 0 } } add = { value = capital_province.county.county_opinion multiply = 2 } } # What level is the main building in my Estate? if = { limit = { domicile ?= { has_domicile_building_or_higher = estate_main_02 } } if = { limit = { domicile ?= { has_domicile_building_or_higher = estate_main_05 } } add = 40 } else_if = { limit = { domicile ?= { has_domicile_building_or_higher = estate_main_04 } } add = 30 } else_if = { limit = { domicile ?= { has_domicile_building_or_higher = estate_main_03 } } add = 20 } else_if = { limit = { domicile ?= { has_domicile_building_or_higher = estate_main_02 } } add = 10 } } } ### EXPECTATIONS # AI Expected Legitimacy default_ai_legitimacy_expectation = { value = 1 # De Jure Vassal if = { limit = { scope:liege = { is_rightful_liege_of = root } } subtract = 1 } # Powerful Vassals expect more if = { limit = { is_powerful_vassal_of = scope:liege } add = 1 } # How long have you been under this dynasty? if = { limit = { days_since_vassal_contract_liege_dynasty_reign_start >= 18250 #50 years } subtract = 1 } if = { limit = { days_since_vassal_contract_liege_dynasty_reign_start >= 36500 #100 years } subtract = 1 } # Vassal Stance if = { limit = { was_preferred_heir = scope:liege } subtract = 1 } # Relations if = { limit = { scope:liege = { OR = { is_spouse_of = root is_close_family_of = root } } } subtract = 1 } # Tier - more legitimacy required for higher tiers if = { limit = { scope:liege.highest_held_title_tier >= tier_county } add = 1 } if = { limit = { scope:liege.highest_held_title_tier >= tier_duchy } add = 1 } if = { limit = { scope:liege.highest_held_title_tier >= tier_kingdom } add = 2 } if = { limit = { scope:liege.highest_held_title_tier >= tier_empire } add = 2 } # Era - more legitimacy required as time goes on if = { limit = { scope:liege.culture = { has_cultural_era_or_later = culture_era_tribal } } subtract = 1 } else_if = { limit = { scope:liege.culture = { has_cultural_era_or_later = culture_era_high_medieval } } add = 2 } else_if = { limit = { scope:liege.culture = { has_cultural_era_or_later = culture_era_late_medieval } } add = 2 } min = 1 max = 4 } default_legitimacy_opinion_penalty = -10 ### EFFECTS legitimacy_regent_swing_scale_multipler_value = { value = 1 # LEGITIMACY OF RULER AFFECTS COSTS if = { limit = { scope:actor = { has_legitimacy_flag = massively_increased_swing_scales_cost } } multiply = 1.75 } if = { limit = { scope:actor = { has_legitimacy_flag = very_increased_swing_scales_cost } } multiply = 1.5 } if = { limit = { scope:actor = { has_legitimacy_flag = increased_swing_scales_cost } } multiply = 1.25 } if = { limit = { scope:actor = { has_legitimacy_flag = reduced_swing_scales_cost } } multiply = 0.85 } if = { limit = { scope:actor = { has_legitimacy_flag = very_reduced_swing_scales_cost } } multiply = 0.75 } if = { limit = { scope:actor = { has_legitimacy_flag = extra_reduced_swing_scales_cost } } multiply = 0.5 } }