From b4ef06f908777854e41a292cf516316be53ee354 Mon Sep 17 00:00:00 2001 From: int19h Date: Thu, 23 Jun 2022 22:43:52 -0700 Subject: [PATCH] Add package info. --- PettyKingdoms.csproj | 6 ++++++ PettyKingdomsCampaignBehavior.cs | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/PettyKingdoms.csproj b/PettyKingdoms.csproj index 11468c0..bc0a5e2 100644 --- a/PettyKingdoms.csproj +++ b/PettyKingdoms.csproj @@ -12,6 +12,12 @@ C:\Program Files (x86)\Steam\steamapps\common\Mount & Blade II Bannerlord Int19h.Bannerlord.$(MSBuildProjectName) Int19h.Bannerlord.$(MSBuildProjectName.Replace(" ", "_")) + Petty Kingdoms for Mount & Blade II: Bannerlord + Copyright © 2022 Pavel "int19h" Minaev + LICENSE.md + https://github.com/int19h/Bannerlord.PettyKingdoms + https://github.com/int19h/Bannerlord.PettyKingdoms + Pavel Minaev diff --git a/PettyKingdomsCampaignBehavior.cs b/PettyKingdomsCampaignBehavior.cs index e718037..b28fbd8 100644 --- a/PettyKingdomsCampaignBehavior.cs +++ b/PettyKingdomsCampaignBehavior.cs @@ -1,4 +1,6 @@ -using TaleWorlds.CampaignSystem; +using System.Linq; +using TaleWorlds.CampaignSystem; +using TaleWorlds.CampaignSystem.Actions; namespace Int19h.Bannerlord.PettyKingdoms { internal class PettyKingdomsCampaignBehavior : CampaignBehaviorBase { @@ -13,6 +15,12 @@ public override void SyncData(IDataStore dataStore) { } private void OnDailyTick() { + foreach (var kingdom in Kingdom.All.ToArray()) { + if (!kingdom.IsEliminated && kingdom.Fiefs.Count == 0 && kingdom.Clans.Count <= 1) { + ChangeKingdomAction.ApplyByLeaveWithRebellionAgainstKingdom(kingdom.RulingClan, false); + DestroyKingdomAction.Apply(kingdom); + } + } } } }