Esempio n. 1
0
            private static float GetWarMultForClan(Clan clan, Kingdom kingdom)
            {
                var campaignWars = Campaign.Current.FactionManager.FindCampaignWarsOfFaction(kingdom);

                if (campaignWars.Count == 0)
                {
                    return(1.0f);
                }

                // Start with the current raw kingdom strength. This represents total men, garrisons, etc.
                var totalKingdomScore    = kingdom.TotalStrength;
                var totalOppositionScore = FactionHelper.GetTotalEnemyKingdomPower(kingdom);

                // Add additional points for renown gained, raids, and sieges in the current wars.
                foreach (var campaignWar in campaignWars)
                {
                    FindSides(campaignWar, kingdom, out var kingdomSide, out var oppositionSide);

                    var(kingdomScore, oppositionScore) = CalculateWarScore(campaignWar, kingdomSide, oppositionSide);
                    totalKingdomScore    += kingdomScore;
                    totalOppositionScore += oppositionScore;
                }
                var warMult = totalKingdomScore / totalOppositionScore;

                if ((warMult < 1) &&
                    (clan.Culture == kingdom.Culture))
                {
                    // Clans do not leave their own culture when losing wars.
                    return(1.0f);
                }

                return(Clamp(warMult, 0, 1.5f));
            }