Skip to content

Commit

Permalink
Various fixes to mod generation (#2265)
Browse files Browse the repository at this point in the history
  • Loading branch information
IhateTrains authored Oct 13, 2024
1 parent 98f12b8 commit f2b0b48
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
13 changes: 7 additions & 6 deletions ImperatorToCK3/CK3/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,20 +346,21 @@ public World(Imperator.World impWorld, Configuration config, Thread? irCoaExtrac

Dynasties.SetCoasForRulingDynasties(LandedTitles, config.CK3BookmarkDate);

Characters.RemoveEmployerIdFromLandedCharacters(LandedTitles, CorrectedDate);
Characters.PurgeUnneededCharacters(LandedTitles, Dynasties, DynastyHouses, config.CK3BookmarkDate);
// We could convert Imperator character DNA while importing the characters.
// But that'd be wasteful, because some of them are purged. So, we do it now.
Characters.ConvertImperatorCharacterDNA(dnaFactory);

// If there's a gap between the I:R save date and the CK3 bookmark date,
// generate successors for old I:R characters instead of making them live for centuries.
if (config.CK3BookmarkDate.DiffInYears(impWorld.EndDate) > 1) {
Characters.GenerateSuccessorsForOldCharacters(LandedTitles, Cultures, impWorld.EndDate, config.CK3BookmarkDate, impWorld.RandomSeed);
}

// Gold needs to be distributed after characters' successors are generated.
Characters.DistributeCountriesGold(LandedTitles, config);
Characters.ImportLegions(LandedTitles, impWorld.Units, impWorld.Characters, CorrectedDate, unitTypeMapper, MenAtArmsTypes, provinceMapper, LocDB, config);

Characters.RemoveEmployerIdFromLandedCharacters(LandedTitles, CorrectedDate);
Characters.PurgeUnneededCharacters(LandedTitles, Dynasties, DynastyHouses, config.CK3BookmarkDate);
// We could convert Imperator character DNA while importing the characters.
// But that'd be wasteful, because some of them are purged. So, we do it now.
Characters.ConvertImperatorCharacterDNA(dnaFactory);

// After the purging of unneeded characters, we should clean up the title history.
LandedTitles.CleanUpHistory(Characters, config.CK3BookmarkDate);
Expand Down
7 changes: 0 additions & 7 deletions ImperatorToCK3/Data_Files/configurables/converter_faiths.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5336,7 +5336,6 @@ elamite_religion = { # from Bronze Age Reborn mod

#Mortuary Practices
doctrine = doctrine_funeral_stoic
doctrine = doctrine_tomb_type_chamber_tomb

#Marriage
doctrine = doctrine_monogamy
Expand All @@ -5358,15 +5357,9 @@ elamite_religion = { # from Bronze Age Reborn mod
doctrine = doctrine_clerical_marriage_allowed
doctrine = doctrine_clerical_succession_temporal_appointment

#Special
doctrine = doctrine_infanticide_none

#Allow pilgrimages
doctrine = doctrine_pilgrimage_encouraged

#For Elamite Syncretism
doctrine = special_doctrine_is_elamite_faith

traits = {
virtues = { honest just diligent compassionate }
sins = { deceitful arbitrary lazy sadistic callous }
Expand Down
7 changes: 6 additions & 1 deletion ImperatorToCK3/Outputter/CharacterOutputter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ public static void WriteCharacter(StringBuilder sb, Character character, Date co
string effectStr = gold > 0 ?
$"{{ add_gold={gold.ToString("0.00", CultureInfo.InvariantCulture)} }}" :
$"{{ remove_long_term_gold={(-gold).ToString("0.00", CultureInfo.InvariantCulture)} }}";
character.History.AddFieldValue(ck3BookmarkDate, "effects", "effect", effectStr);
Date goldDate = ck3BookmarkDate;
var deathDate = character.DeathDate;
if (deathDate is not null && deathDate < ck3BookmarkDate) {
goldDate = deathDate;
}
character.History.AddFieldValue(goldDate, "effects", "effect", effectStr);
}

// Output history.
Expand Down

0 comments on commit f2b0b48

Please sign in to comment.