﻿### ai_men_at_arms_chance_landless_ruler
# Chance the AI will prefer MaA to buildings when they are a landless ruler.
# Scoped to: root (character)
# Rise and Fall mod override file. If the realm law `camp_purpose_legitimist` is present
# the value is forced to 1 and no other modifiers apply.

ai_men_at_arms_chance_landless_ruler = {
	value = {
		value = 0.5
		desc = "default value"
		if = {
			limit = {
				OR = {
					has_realm_law = camp_purpose_mercenaries
					has_realm_law = camp_purpose_brigands
				}
			}
			add = 0.25
		}
		if = {
			limit = {
				has_realm_law = camp_purpose_scholars
			}
			add = -0.25
		}
		if = { # Landless admin focus mostly on Buildings
			limit = {
				government_has_mechanic = administrative
			}
			add = -0.3
		}
		if = { # Adventurers want a minimum set of buildings
			limit = {
				has_government = landless_adventurer_government
				NOT = { has_character_flag = riseandfall_newadventurer }
				max_military_strength >= 100
				domicile.num_domicile_buildings <= 4
			}
			add = -0.4
		}
		if = { # To avoid Adventurer travels becoming super-costly provision-wise, they should focus on buildings over MaA at certain ratios
			limit = {
				has_government = landless_adventurer_government
				NOT = { has_character_flag = riseandfall_newadventurer }
				max_military_strength >= 500
				domicile.max_provisions <= 4000
			}
			multiply = 0
		}
		if = { # To avoid Adventurer travels becoming super-costly provision-wise, they should focus on buildings over MaA at certain ratios
			limit = {
				vassal_contract_has_flag = celestial_grand_marshal_obligation
			}
			add = 1
		}

		# Mod-created legitimists should keep building armies regardless of generic landless AI modifiers.
		if = {
			limit = { has_realm_law = camp_purpose_legitimists has_character_flag = riseandfall_newadventurer }
			value = 1.0
		}

		min = 0
		max = 0.9
	}
}
