From d5d5a33ab65672a29a6ce1f22615e0af9308839e Mon Sep 17 00:00:00 2001 From: IhateTrains Date: Wed, 11 Oct 2023 00:38:52 +0100 Subject: [PATCH] Prevent exception when generating eremitic holder for c_faereyar (#1554) #patch --- ImperatorToCK3/CK3/World.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ImperatorToCK3/CK3/World.cs b/ImperatorToCK3/CK3/World.cs index 01475e876..efd70c803 100644 --- a/ImperatorToCK3/CK3/World.cs +++ b/ImperatorToCK3/CK3/World.cs @@ -565,15 +565,15 @@ private void HandleIcelandAndFaroeIslands(Configuration config) { Logger.Debug($"Generating hermit for {titleId}..."); var hermit = new Character($"IRToCK3_{titleId}_hermit", namePool.Dequeue(), bookmarkDate.ChangeByYears(-50), Characters); - var faithId = faithCandidates.First(c => faiths.Any(f => f.Id == c)); - hermit.SetFaithId(faithId, null); - hermit.SetCultureId(cultureId, null); - hermit.History.AddFieldValue(null, "traits", "trait", "chaste"); - hermit.History.AddFieldValue(null, "traits", "trait", "celibate"); - hermit.History.AddFieldValue(null, "traits", "trait", "devoted"); + var faithId = faithCandidates.First(c => faiths.Exists(f => f.Id == c)); + hermit.SetFaithId(faithId, date: null); + hermit.SetCultureId(cultureId, date: null); + hermit.History.AddFieldValue(date: null, "traits", "trait", "chaste"); + hermit.History.AddFieldValue(date: null, "traits", "trait", "celibate"); + hermit.History.AddFieldValue(date: null, "traits", "trait", "devoted"); var eremiteEffect = new StringOfItem("{ set_variable = IRToCK3_eremite_flag }"); hermit.History.AddFieldValue(config.CK3BookmarkDate, "effects", "effect", eremiteEffect); - Characters.Add(hermit); + Characters.AddOrReplace(hermit); title.SetHolder(hermit, bookmarkDate); title.SetGovernment("eremitic_government", bookmarkDate);