A lot of updating, making republics work

This commit is contained in:
Thakia 2026-11-24 16:18:56 -03:00
parent 09fb57c091
commit 4d6f569e96
99 changed files with 9792 additions and 9342 deletions

View file

@ -10,7 +10,12 @@ standard_truce_duration_days = {
## Flexible truces perk.
if = {
limit = {
scope:attacker = { has_perk = flexible_truces_perk }
scope:attacker = {
has_perk = flexible_truces_perk
NOT = {
government_has_flag = government_is_republic
}
}
}
add = -450
}
@ -88,7 +93,7 @@ determined_independence_defensive_advantage_value = 15
not_tribal_raid_prestige_multiplier = 1.5
raid_gold_value = { #How much cash does this settlement generate in a raid?
value = monthly_income
value = total_monthly_tax_income
multiply = 10
#Sensible max-mins.
@ -100,7 +105,7 @@ raid_gold_value = { #How much cash does this settlement generate in a raid?
}
tour_tax_gold_value = {
value = monthly_income
value = total_monthly_tax_income
multiply = 4
#Give a whole number.
@ -272,7 +277,7 @@ byzantium_conquests_ai_score_value = {
## Y'know, roughly.
AND = {
NOT = {
exists = title:e_byzantium
exists = title:e_byzantium.holder
}
primary_title = {
tier <= tier_empire
@ -281,13 +286,13 @@ byzantium_conquests_ai_score_value = {
empire = title:e_latin_empire
}
}
OR = {
culture = { has_cultural_pillar = heritage_byzantine }
culture = culture:greek
culture = {
any_parent_culture_or_above = {
culture = {
OR = {
this = culture:greek
any_parent_culture_or_above = {
this = culture:greek
}
has_cultural_pillar = heritage_byzantine
}
}
}
@ -387,25 +392,20 @@ muslim_invasions_prefer_nonmuslims_ai_score_value = {
}
every_in_list = {
list = target_titles
limit = {
trigger_if = {
limit = {
tier >= tier_county
is_title_created = yes
}
holder.top_liege.religion != religion:islam_religion
}
}
if = {
limit = {
OR = {
AND = {
tier = tier_county
NOT = { holder.top_liege.religion = religion:islam_religion }
any_county_province = {
geographical_region = ghw_region_holy_land
}
}
AND = {
tier > tier_county
any_in_de_jure_hierarchy = {
tier = tier_county
NOT = { holder.top_liege.religion = religion:islam_religion }
any_county_province = {
geographical_region = ghw_region_holy_land
}
}
any_de_jure_county = {
title_province = {
geographical_region = ghw_region_holy_land
}
}
}
@ -413,50 +413,18 @@ muslim_invasions_prefer_nonmuslims_ai_score_value = {
}
else_if = {
limit = {
OR = {
AND = {
tier = tier_county
NOT = { holder.top_liege.religion = religion:islam_religion }
any_county_province = {
OR = {
geographical_region = ghw_region_anatolia
geographical_region = world_india
}
}
}
AND = {
tier > tier_county
any_in_de_jure_hierarchy = {
tier = tier_county
NOT = { holder.top_liege.religion = religion:islam_religion }
any_county_province = {
OR = {
geographical_region = ghw_region_anatolia
geographical_region = world_india
}
}
any_de_jure_county = {
title_province = {
OR = {
geographical_region = ghw_region_anatolia
geographical_region = world_india
}
}
}
}
add = 200
}
else_if = {
limit = {
OR = {
AND = {
tier = tier_county
NOT = { holder.top_liege.religion = religion:islam_religion }
}
AND = {
tier > tier_county
any_in_de_jure_hierarchy = {
tier = tier_county
NOT = { holder.top_liege.religion = religion:islam_religion }
}
}
}
}
else = {
add = 2
}
}
@ -484,6 +452,114 @@ pam_peace_of_god_coreligionist_war_ai_score_value = {
}
}
frankokratia_leader_protection_value = {
#Added at the end of every ai_score_mult in all CBs for now.
#Fourth Crusade flavor:
#We protect the Frankokratia leader to avoid breaking the story cycle.
if = {
limit = {
scope:defender = {
any_owned_story = {
type = frankokratia_story
NOT = { has_variable = franko_war_complete }
}
}
}
value = 0
}
else = {
value = 1
}
}
# The AI Mongol invader only uses its dedicated invasion CBs, which skip common_cb_ai_score_mult
mongol_invader_regular_cb_ai_score_value = {
value = 1
if = {
limit = {
scope:attacker = {
any_owned_story = { story_type = story_mongol_invasion }
}
}
value = 0
}
}
# notice not all cbs have target_titles or scope:target. don't add those without protection
common_cb_ai_score_mult = {
value = 1
multiply = frankokratia_leader_protection_value
multiply = mongol_invader_regular_cb_ai_score_value
}
# for any cb taking land
aggressive_cb_ai_score_mult = {
value = 1
if = {
limit = {
# other govs are ignored intentionally: you might be able to hold tribal as merits but that is not a good idea
scope:attacker = {
NOR = {
government_has_flag = government_is_tribal
government_has_flag = government_is_nomadic
government_has_flag = government_is_landless_adventurer # you change to those govs when you get land anyway
}
}
any_in_list = {
list = target_titles
feudal_clan_tribal_conquest_constraints = yes
}
}
multiply = 0
}
multiply = zealous_war_on_head_of_faith_ai_score_value
multiply = struggle_wars_prioritise_struggle_targets_value
multiply = byzantium_conquests_ai_score_value
multiply = muslim_invasions_prefer_nonmuslims_ai_score_value
multiply = pam_peace_of_god_coreligionist_war_ai_score_value
}
religious_cb_ai_score_mult = {
value = 1
# Increase odds if the character is a vassal with Ghazi Contract
if = {
limit = {
scope:attacker = {
top_liege != this
vassal_contract_has_flag = vassal_contract_cheaper_religious_war
}
}
add = 1
}
# Holy Wars are limited to connected neighbours to limit big empire expansions over weak realms.
if = {
limit = { religious_war_vassals_constraints = yes }
multiply = 0
}
}
vassalization_cb_ai_score_mult = {
if = {
limit = {
OR = {
AND = {
scope:attacker = {
NOT = { government_has_flag = government_is_tribal }
}
scope:defender = {
government_has_flag = government_is_tribal
}
}
scope:attacker = {
government_has_flag = government_is_mandala
vassal_limit_available < 1
}
}
}
value = 0
}
else = {
value = 1
}
}
zealous_war_on_head_of_faith_ai_score_value = {
value = 1
if = {
@ -498,6 +574,9 @@ zealous_war_on_head_of_faith_ai_score_value = {
}
}
common_cb_ai_score_mult_additive = {
add = house_relation_ai_score_value
}
# Raid for captives
raid_for_captives_ai_score_value = {
value = 10
@ -723,9 +802,9 @@ siege_base_capture_chance = {
limit = {
OR = {
# Either you're involved in large groups of the holding surrendering...
scope:barony.culture = { has_cultural_parameter = knights_die_less_but_are_captured_more }
scope:barony.culture = { has_cultural_parameter = characters_more_likely_to_be_captured_in_sieges }
# ... or you know your liege will pay your ransom.
scope:barony.holder.culture = { has_cultural_parameter = knights_die_less_but_are_captured_more }
scope:barony.holder.culture = { has_cultural_parameter = characters_more_likely_to_be_captured_in_sieges }
}
# Ransoms or no, the primary participants & their heirs know better than to surrender.
character_is_potential_valuable_prisoner = no
@ -759,7 +838,7 @@ raid_base_capture_chance = {
}
county_control_loss_value = {
value = -40
value = -30
# Dynasty Perk: No Quarter
if = {
@ -773,7 +852,7 @@ county_control_loss_value = {
}
raid_county_control_loss_value = {
value = -10
value = -5
# Dynasty Perk: No Quarter
if = {
@ -782,7 +861,7 @@ raid_county_control_loss_value = {
dynasty ?= { has_dynasty_perk = fp1_pillage_legacy_5 }
}
}
add = -20
add = -10
}
}
@ -831,7 +910,7 @@ root_military_strength_higher_than_military_target_value = {
}
if = {
limit = { exists = var:ai_strength_multiplier }
multiply = var:ai_strength_multiplier # 1.25 == 25% stronger than, remember to potty train your script and have it remove the variable after usage!!
multiply = var:ai_strength_multiplier # 1.25 == 25% stronger than, remember to potty train your script and have it remove the variable after usage!!
}
}
@ -855,7 +934,7 @@ target_military_strength_root_value = {
# Compute military strength against *scope:recipient*.
#
# This script value and the one after it are to be used in combination as
# "root_military_strength_higher_than_recipient_value > recipient_strength_root_value"
# "root_military_strength_higher_than_recipient_value > recipient_strength_root_value"
# to check player vs enemy strength.
root_military_strength_higher_than_recipient_value = {
value = 0
@ -997,7 +1076,7 @@ house_relation_ai_score_value = {
if = {
limit = {
scope:defender.house ?= {
NOT = { this = scope:attacker.house }
this != scope:attacker.house
has_house_relation_with = scope:attacker.house
}
}
@ -1017,28 +1096,85 @@ house_relation_ai_score_value = {
}
}
}
house_relation_less_likely_war_target_value = -150
house_relation_more_likely_war_target_value = 150
house_relation_less_likely_war_target_value = -0.75
house_relation_more_likely_war_target_value = 1.5
frankokratia_leader_protection_value = {
#Multiplied at the end of every ai_score_mult in all CBs for now.
# Reparations take at most what the payer holds plus this many years of income
reparations_max_debt_years_value = 1
#Fourth Crusade flavor:
#We protect the Frankokratia leader to avoid breaking the story cycle.
# EXPECTS: paying character scope
# 1 plus existing debt in years of income, and we divide the new debt allowance by this
reparations_gold_debt_divisor_value = {
value = 1
if = {
limit = {
scope:defender = {
any_owned_story = {
type = frankokratia_story
NOT = { has_variable = franko_war_complete }
}
}
gold < 0
yearly_character_income > 0
}
add = {
value = gold
multiply = -1
divide = yearly_character_income
}
multiply = 0
}
}
reparations_treasury_debt_divisor_value = {
value = 1
if = {
limit = {
treasury < 0
yearly_character_income > 0
}
add = {
value = treasury
multiply = -1
divide = yearly_character_income
}
}
}
# EXPECTS: paying character scope. Currency matches pay_treasury_or_gold.
reparations_max_payment_value = {
value = yearly_character_income
multiply = reparations_max_debt_years_value
if = {
limit = {
has_treasury = yes
government_allows = replace_gold_cost_by_treasury
}
if = {
limit = { treasury > 0 }
add = treasury
}
else = {
divide = reparations_treasury_debt_divisor_value
}
}
else_if = {
limit = { gold > 0 }
add = gold
}
else = {
divide = reparations_gold_debt_divisor_value
}
min = 1
}
# EXPECTS: paying character scope, for reparations paid in gold only
reparations_max_gold_payment_value = {
value = yearly_character_income
multiply = reparations_max_debt_years_value
if = {
limit = { gold > 0 }
add = gold
}
else = {
divide = reparations_gold_debt_divisor_value
}
min = 1
}
### Overlord join probability (fixed point between 0 and 1)
# fallback value if the value is not defined in the selected casus belli.
# Uses same logic and scope as the same field defined in casus_belli.