From 9769aa781479a6f42d7cdbcc3f03bae612ea89b1 Mon Sep 17 00:00:00 2001 From: 3ger <41837307+3ger@users.noreply.github.com> Date: Wed, 27 Dec 2023 17:58:05 +0100 Subject: [PATCH] Added modifier to alliance tendency when leader clans married --- .../DiplomaticAction/AbstractScoringModel.cs | 8 ++++++++ .../DiplomaticAction/Alliance/AllianceScoringModel.cs | 3 +++ .../NonAggressionPact/NonAggressionPactScoringModel.cs | 1 + src/Bannerlord.Diplomacy/Settings.cs | 4 ++++ .../ModuleData/Languages/std_module_strings_xml.xml | 6 +++++- 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractScoringModel.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractScoringModel.cs index fff520ba..085533cd 100644 --- a/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractScoringModel.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/AbstractScoringModel.cs @@ -32,6 +32,11 @@ public virtual ExplainedNumber GetScore(Kingdom ourKingdom, Kingdom otherKingdom if (!ourKingdom.IsStrong()) explainedNum.Add(Scores.BelowMedianStrength, _TWeakKingdom); + // Marriage score + + if (Settings.Instance!.LeaderClanMarriageAffectsAlliance && ourKingdom.RulingClan.HasMarriedClanLeaderRelation(otherKingdom.RulingClan)) + explainedNum.Add(Scores.LeaderClanMarriage, CreateTextWithKingdom(SMarriageWithLeaderClan, otherKingdom)); + // Common Enemies var commonEnemies = FactionManager.GetEnemyKingdoms(ourKingdom).Intersect(FactionManager.GetEnemyKingdoms(otherKingdom)); @@ -129,6 +134,8 @@ public interface IDiplomacyScores public int Relationship { get; } public int Tendency { get; } + + public int LeaderClanMarriage { get; } } private static readonly TextObject _TWeakKingdom = new("{=q5qphBwi}Weak Kingdom"); @@ -139,6 +146,7 @@ public interface IDiplomacyScores private const string SWarWithKingdom = "{=RqQ4oqvl}War with {KINGDOM}"; private const string SAllianceWithKingdom = "{=cmOSpfyW}Alliance with {KINGDOM}"; private const string SPactWithKingdom = "{=t6YhBLj7}Non-Aggression Pact with {KINGDOM}"; + private const string SMarriageWithLeaderClan = "{=BjkwaNot}Marriage with leading clan of {KINGDOM}"; private const string SCommonEnemy = SWarWithKingdom; private const string SAlliedToEnemy = SAllianceWithKingdom; diff --git a/src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/AllianceScoringModel.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/AllianceScoringModel.cs index 2ff15609..4f858255 100644 --- a/src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/AllianceScoringModel.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/Alliance/AllianceScoringModel.cs @@ -21,7 +21,10 @@ public class AllianceScores : IDiplomacyScores public int Tendency => Settings.Instance!.AllianceTendency; public int NonAggressionPactWithEnemy => -1000; + public int NonAggressionPactWithNeutral => -10; + + public int LeaderClanMarriage => 50; } } } \ No newline at end of file diff --git a/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/NonAggressionPactScoringModel.cs b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/NonAggressionPactScoringModel.cs index d214c470..1743034f 100644 --- a/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/NonAggressionPactScoringModel.cs +++ b/src/Bannerlord.Diplomacy/DiplomaticAction/NonAggressionPact/NonAggressionPactScoringModel.cs @@ -15,6 +15,7 @@ public class NonAggressionPactScores : IDiplomacyScores public int Tendency => Settings.Instance!.NonAggressionPactTendency; public int NonAggressionPactWithEnemy => -20; public int NonAggressionPactWithNeutral => -10; + public int LeaderClanMarriage => 50; } } } \ No newline at end of file diff --git a/src/Bannerlord.Diplomacy/Settings.cs b/src/Bannerlord.Diplomacy/Settings.cs index aa372298..0fcf9c3e 100644 --- a/src/Bannerlord.Diplomacy/Settings.cs +++ b/src/Bannerlord.Diplomacy/Settings.cs @@ -68,6 +68,10 @@ class Settings : AttributeGlobalSettings [SettingPropertyGroup(HeadingKingdomDiplomacy)] public int MinimumAllianceDuration { get; set; } = 42; + [SettingPropertyBool("{=xXKKRp99}Leader Clan Family Marriage Affects Alliance", Order = 33, RequireRestart = false, HintText = "{=BGS6mUID}If active, will grant a bonus to alliance tendency when leader clans have a family marriage between them. Default value is active.")] + [SettingPropertyGroup(HeadingKingdomDiplomacy)] + public bool LeaderClanMarriageAffectsAlliance { get; set; } = true; + [SettingPropertyInteger("{=V35hUfcc}Non-Aggression Pact Duration in Days", 0, 1000, Order = 50, RequireRestart = false, HintText = "{=KXLGZEPh}The duration (in days) that a non-aggression pact will last. Default value is 84 (one standard game year).")] [SettingPropertyGroup(HeadingKingdomDiplomacy)] public int NonAggressionPactDuration { get; set; } = 84; diff --git a/src/Bannerlord.Diplomacy/_Module/ModuleData/Languages/std_module_strings_xml.xml b/src/Bannerlord.Diplomacy/_Module/ModuleData/Languages/std_module_strings_xml.xml index 13187f6e..3ada5da7 100644 --- a/src/Bannerlord.Diplomacy/_Module/ModuleData/Languages/std_module_strings_xml.xml +++ b/src/Bannerlord.Diplomacy/_Module/ModuleData/Languages/std_module_strings_xml.xml @@ -126,6 +126,7 @@ + @@ -195,7 +196,10 @@ - + + + +