private Kingdom GoRebelKingdom(Clan clan, IEnumerable <Settlement> settlements) { var capital = settlements.First(); var owner = capital.OwnerClan; // create a new kingdom for the clan TextObject kingdomIntroText = new TextObject("{=Separatism_Kingdom_Intro_Anarchy}{RebelKingdom} was found in {Year} as a result of anarchy in fiefs of the {ClanName} when people of {Settlement} have called {Ruler} on rulership.", null); kingdomIntroText.SetTextVariable("Year", CampaignTime.Now.GetYear); kingdomIntroText.SetTextVariable("ClanName", owner.Name); kingdomIntroText.SetTextVariable("Settlement", capital.Name); kingdomIntroText.SetTextVariable("Ruler", clan.Leader.Name); var kingdom = clan.CreateKingdom(kingdomIntroText); // keep policies from the old settlement kingdom foreach (var policy in owner.Kingdom.ActivePolicies) { kingdom.AddPolicy(policy); } // move the clan out of its current kingdom clan.ChangeKingdom(null, false); // change settlement ownership foreach (var s in settlements) { ChangeOwnerOfSettlementAction.ApplyByRevolt(clan.Leader, s); } // move the clan into the new kingdom clan.ChangeKingdom(kingdom, false); // declare wars kingdom.InheritsWarsFromKingdom(owner.Kingdom); DeclareWarAction.Apply(owner.Kingdom, kingdom); return(kingdom); }
private Kingdom GoRebelKingdom(Clan clan) { // create a new kingdom for the clan TextObject kingdomIntroText = new TextObject("{=Separatism_Kingdom_Intro}{RebelKingdom} was found in {Year} when the {ClanName} have rised a rebellion against {Ruler} ruler of {Kingdom}.", null); kingdomIntroText.SetTextVariable("Year", CampaignTime.Now.GetYear); kingdomIntroText.SetTextVariable("ClanName", clan.Name); kingdomIntroText.SetTextVariable("Ruler", clan.Kingdom.Ruler.Name); kingdomIntroText.SetTextVariable("Kingdom", clan.Kingdom.Name); var kingdom = clan.CreateKingdom(kingdomIntroText); // keep policies from the old clan kingdom foreach (var policy in clan.Kingdom.ActivePolicies) { kingdom.AddPolicy(policy); } // move the clan into its new kingdom clan.ChangeKingdom(kingdom, true); return(kingdom); }