Some code analysis here. Most of calculations done in GetScoreOfWarInternal() function. From that, we can tell which factors will increase score and which will decrease the score of war. If score > 50 then war will be declared.
Factors that increase the score:
Clan leaders Valor trait;
Target faction aggressiveness;
Benefit Score for the attacker faction;
Top Dog score;
The negative relationship between rulers of the factions;
Add score if total strength of the attacker faction > total strength of the target faction;
Number of settlements in Target faction with the culture same as the attacker's culture;
Factors that decrease the score:
Clan leaders Mercy trait;
Benefit Score for the target faction;
The positive relationship between rulers of the factions;
War fatigue score;
Decrease score if the attacker of the target faction are already in war;
Also, there one very suspicious function - CalculateBenefitScore(), this function calculates if the faction can get some benefit of the war.
C#:
private float CalculateBenefitScore(ref DefaultDiplomacyModel.WarStats faction1Stats, ref DefaultDiplomacyModel.WarStats faction2Stats, bool calculatingRisk = false)
{
float num = MathF.Clamp(faction2Stats.ValueOfSettlements + 1f, DefaultDiplomacyModel._MinValue, DefaultDiplomacyModel._MaxValue);
float num2 = (faction2Stats.Strength + 10f) / (faction1Stats.Strength + 10f);
float num3 = (faction2Stats.Strength + 0.3f * faction1Stats.TotalStrengthOfEnemies + 10f) / (faction1Stats.Strength + 0.3f * faction2Stats.TotalStrengthOfEnemies + 10f);
float num4 = MathF.Pow(num2 * num3, 0.4f);
float num5 = MathF.Sqrt(faction1Stats.DistanceToClosestEnemyFief / faction2Stats.DistanceToClosestEnemyFief);
num4 *= num5;
if (!calculatingRisk)
{
float x = Math.Min(1f, 2f * (faction1Stats.Strength + 10f) / (faction1Stats.Strength + faction1Stats.TotalStrengthOfEnemies + 10f));
num4 /= MathF.Pow(x, 0.5f);
}
float num6 = 1f / (1f + num4);
num6 = MathF.Clamp(num6, 0.01f, 0.99f);
float num7 = num * num6;
float num8 = 150f / (150f + faction1Stats.DistanceToClosestEnemyFief);
return num7 * num8;
}
It looks very obscured, however, we do not need to know what exactly it does, we only need to understand the general idea.
Result of this function is:
Target faction Settlements value * Strength Factor / Distance to Closest Enemy Fief;
And the suspicious part of it is a Strength Factor that in the code "num6".
Strength Factor ~ (Total strength of Attacker faction + Total strength of all enemies of Target faction) / (Total strength of Target faction + Total strength of all enemies of Attacker faction);
The Strength Factor has a greater score when the Target faction is in war with multiple factions. And it's even greater if Target faction is weakened by war.
This explains why everyone in Calradia gang banging weak factions.