﻿###################
# FACTION VALUES  #
###################

base_discontent_progress = 3

minor_discontent_gain = 10
medium_discontent_gain = 20
major_discontent_gain = 30
minor_discontent_loss = -10
medium_discontent_loss = -20
major_discontent_loss = -30
massive_discontent_loss = -50

faction_war_white_peace_cooldown = 5 # years
faction_war_defeat_cooldown = 10 # years

faction_nation_fracturing_war_white_peace_cooldown = 15 # years
faction_nation_fracturing_war_defeat_cooldown = 30 # years


liberty_war_victory_cooldown = 5

# Values for the AI to evaluate how powerful factions are relative to each other.
faction_power_minimal = {
	value = faction_power_threshold
	multiply = 0.25
}
faction_power_halfway_threshold = {
	value = faction_power_threshold
	multiply = 0.50
}
faction_power_pushing_threshold = {
	value = faction_power_threshold
	multiply = 0.75
}

faction_weight_factor_power_minimal_penalty = 0.5
faction_weight_factor_power_halfway_threshold = 1.20 # +20% total faction weight
faction_weight_factor_power_pushing_threshold = 1.5 # +50% total faction weight
faction_weight_factor_power_exceeds_threshold = 2 # +100% total faction weight

faction_discontent_for_extra_power = {
	value = base_discontent_progress
	multiply = { # We want discontent to increase gradually as a faction grows their military power.
		value = faction_power
		subtract = faction_power_threshold
		divide = faction_power_threshold  # To get the % over the power threshold we are.
		multiply = 4 # At 25% bonus faction power, discontent increases 100% faster (compared to the base gain).
	}
	round = yes # To avoid having it say +0...
	max = 10 # Minimum 8 months to reach 100% discontent (no insta-revolts, no matter how powerful the faction is).
}

total_county_levies = {
	value = 0

	# Get the base levies from each province.
	every_in_de_jure_hierarchy = {
		limit = {
			tier = tier_barony
		}
		title_province = {
			add = building_levies
		}
	}

	# Levy size multipliers (excluding ruler-specific modifiers, such as Martial skill).
	multiply = {
		# 100% Levy Base
		value = 1

		# Adds bonus levies from Development (at base 20 development, +20% levies).
		add = {
			add = development_level
			multiply = 0.01
		}

		# Adds bonus levies from cultural innovations.
		if = {
			limit = {
				culture = {
					has_innovation = innovation_bannus
				}
			}
			add = 0.1
		}
	}
}

county_levies_to_raise = {
	value = total_county_levies

	# Will summon between 75% and 175% of total county levy strength, depending on how much they hate you (most commonly will be 95-110% though, scores between -20 and -35 are the most common)
	multiply = {
		value = county_opinion
		multiply = -0.01
		add = 0.5
	}
	min = {
		value = building_max_garrison
		multiply = 1.2
	}
}

county_maa_to_raise = {
	value = total_county_levies
	
	# Based on county levy strength, summon an appropiate number of MAAs that scales with popular opinion.
	multiply = {
		value = county_opinion
		multiply = -0.00003
	}
	round = yes
	min = 1
}

peasant_war_victory_county_control_loss = -75
peasant_war_starts_county_control_loss = -25

liege_opinion_value = {
	value = scope:opinion_of_current_liege
}

# How many years of truce do you get with a faction's members for appointing their leader as co-emperor?
faction_counter_offer_appointed_co_emperor_value = 10
