Skip to content

Commit

Permalink
More fixes for TFE
Browse files Browse the repository at this point in the history
  • Loading branch information
IhateTrains committed Jan 8, 2025
1 parent d816f3e commit 09545b8
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 8 deletions.
10 changes: 5 additions & 5 deletions ImperatorToCK3/CK3/Titles/LandedTitles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public void CleanUpHistory(CharacterCollection characters, Date ck3BookmarkDate)
}

holderField.RemoveAllEntries(
value => value.ToString() is string valStr && valStr != "0" && !validIds.Contains(valStr)
value => value.ToString()?.RemQuotes() is string valStr && valStr != "0" && !validIds.Contains(valStr)
);
}

Expand Down Expand Up @@ -313,7 +313,7 @@ public void CleanUpHistory(CharacterCollection characters, Date ck3BookmarkDate)
}

var lastEntry = entriesList.Last();
var liegeTitleId = lastEntry.Value.ToString();
var liegeTitleId = lastEntry.Value.ToString()?.RemQuotes();
if (liegeTitleId is null || liegeTitleId == "0") {
continue;
}
Expand All @@ -324,9 +324,9 @@ public void CleanUpHistory(CharacterCollection characters, Date ck3BookmarkDate)
// Instead of removing the liege entry, see if the liege title has a holder at a later date,
// and move the liege entry to that date.
liegeTitle.History.Fields.TryGetValue("holder", out var liegeHolderField);
Date? laterDate = liegeHolderField?.DateToEntriesDict.Keys
.Where(d => d > date && d <= ck3BookmarkDate)
.Min();
Date? laterDate = liegeHolderField?.DateToEntriesDict
.Where(kvp => kvp.Value.Count != 0 && kvp.Key > date && kvp.Key <= ck3BookmarkDate)
.Min(kvp => kvp.Key);

if (laterDate == null) {
liegeField.DateToEntriesDict.Remove(date);
Expand Down
4 changes: 2 additions & 2 deletions ImperatorToCK3/CK3/Titles/Title.cs
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,8 @@ public HashSet<string> GetAllHolderIds() {
return ids;
}
public void SetHolder(Character? character, Date date) {
var id = character is null ? "0" : character.Id;
History.AddFieldValue(date, "holder", "holder", id);
var holderId = character is null ? "0" : character.Id;
History.AddFieldValue(date, "holder", "holder", holderId);
}

public void SetDevelopmentLevel(int value, Date date) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@
jamshid
1029100 # Sassanid, referenced in events\dlc\fp3\fp3_struggle_events.txt
613 # Seljuk, referenced in events\yearly_events\yearly_events_persia.txt
25061 # Karling, referenced in common/achievements/standard_achievements.txt
25061 # Karling, referenced in common/achievements/standard_achievements.txt

# TFE
900021 # referenced in common\scripted_guis\sevenhouses.txt
mihran_dynasty # referenced in common\scripted_guis\sevenhouses.txt
suren_dynasty # referenced in common\scripted_guis\sevenhouses.txt
varaz_dynasty # referenced in common\scripted_guis\sevenhouses.txt
spandiyadh_dynasty # referenced in common\scripted_guis\sevenhouses.txt
7511 # referenced in common\scripted_guis\sevenhouses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2362,6 +2362,13 @@ on_TFE_east_asia_start = {
{
NOT = { title:c_trapani.holder = character:belisarius_001 }
}
{
if = {
limit = { character:90028 ?= this }
custom_tooltip = ep3_story_cycle_harrying.3053.b.tt
add_character_flag = hereward_settled_flag
}
}
}

"common/scripted_triggers/tfe_culture_triggers.txt" = {
Expand Down Expand Up @@ -5269,6 +5276,21 @@ radagaisus_declare_war_for_target_title_effect = {
else = {
debug_log = "Failed to find a valid war target for Radagaisus!"
}
}
}

{
goths_flee_effect = {
title:k_visigoths.holder = {
save_scope_as = visigothic_king
}

scope:visigothic_king = {
trigger_event = {
id = gothic_wars.0015
days = 1
}
}
}
}
}
Expand Down Expand Up @@ -12695,4 +12717,20 @@ steppe.6666 = {
{
Näcken
}
}

"common\scripted_modifiers\00_faction_modifiers.txt" = {
{
# Keep it while the Calip is alive
modifier = {
add = -1000
$FACTION_TARGET$ = {
this = character:73683
any_held_title = {
this = title:k_andalusia
}
}
has_game_rule = dissolution_after_caliph_death
}
}
}

0 comments on commit 09545b8

Please sign in to comment.