Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
f5dfccf
Lucius Verus release banner
IhateTrains Nov 1, 2025
542a402
Handle hegemony rank titles in common/landed_titles
IhateTrains Nov 1, 2025
82e8b10
Update flatmap.dds path in BookmarkOutputter for CK3 1.18
IhateTrains Nov 1, 2025
54fbad3
Rename mapping files in preparation for TI -> vanilla CK3 mappings
IhateTrains Nov 2, 2025
4f0afde
Merge branch 'master' into feat/ck3-1.18
IhateTrains Nov 4, 2025
1d48e72
Update invictus_to_vanilla_ck3.txt
IhateTrains Nov 4, 2025
f1a8057
Some TI -> CK3 triangulation pairs
IhateTrains Nov 7, 2025
33e8edb
Update terra_indomita_to_vanilla_ck3.txt
IhateTrains Nov 7, 2025
c03d3d6
Some triangulation pairs west of China
IhateTrains Nov 8, 2025
74d79af
Some triangulation pairs for China
IhateTrains Nov 9, 2025
b2cce74
Some more triangulation pairs
IhateTrains Nov 9, 2025
4ac57e5
Use terra_indomita_to_vanilla_ck3 mappings when it makes sense
IhateTrains Nov 9, 2025
29c1a37
Fix some holes in terra_indomita_to_vanilla_ck3.txt
IhateTrains Nov 9, 2025
e45e07d
Fix some holes in terra_indomita_to_vanilla_ck3.txt
IhateTrains Nov 9, 2025
ca22c48
More triangulation pairs for terra_indomita_to_vanilla_ck3.txt
IhateTrains Nov 9, 2025
c6097a3
More triangulation pairs for terra_indomita_to_vanilla_ck3.txt
IhateTrains Nov 9, 2025
aa3ad54
Parse new landed title attributes
IhateTrains Nov 9, 2025
d5bb392
Don't generate filler holders for noble family counties
IhateTrains Nov 9, 2025
c916a05
Don't try to overwrite history for noble family counties
IhateTrains Nov 9, 2025
56af117
Exclude 2 big TI impassables from automapping
IhateTrains Nov 9, 2025
fb95701
Update terra_indomita_to_vanilla_ck3.txt
IhateTrains Nov 9, 2025
fbb0f30
tanner918 AUH Patch (#2812)
tanner918 Nov 9, 2025
fbdcdd8
Merge branch 'master' into feat/ck3-1.18
IhateTrains Nov 15, 2025
18d3bf5
Merge branch 'master' into feat/ck3-1.18
IhateTrains Nov 15, 2025
37b5c3c
Update terra_indomita_to_vanilla_ck3.txt
IhateTrains Nov 15, 2025
050e1cb
Update terra_indomita_to_vanilla_ck3.txt
IhateTrains Nov 15, 2025
a210b6a
Add Invictus 1.7 -> CK3 province mappings
IhateTrains Nov 15, 2025
f3093ad
Update terra_indomita_to_vanilla_ck3.txt
IhateTrains Nov 15, 2025
2e1b2c0
Update terra_indomita_to_vanilla_ck3.txt
IhateTrains Nov 15, 2025
a7f604e
Update terra_indomita_to_vanilla_ck3.txt
IhateTrains Nov 15, 2025
a2b7660
Exclude h_china from dynamic de jure
IhateTrains Nov 16, 2025
383de82
Calculate character variables for tanner's Dynastic Cycle setup script
IhateTrains Nov 16, 2025
6732071
Unit test for years_with_government and imperator_unrest calculation
IhateTrains Nov 16, 2025
0f376e3
[CodeFactor] Apply fixes
code-factor Nov 16, 2025
800829d
Generate subheading loc for bookmark screen
IhateTrains Nov 16, 2025
7e34d4a
Merge branch 'master' into feat/ck3-1.18
IhateTrains Nov 16, 2025
3479156
Don't remove capital attribute from noble family counties
IhateTrains Nov 16, 2025
88be720
Handle effect field in province history
IhateTrains Nov 16, 2025
adaf5d8
Ignore 3 unneeded new CK3 region keywords
IhateTrains Nov 16, 2025
d36a4a7
Handle `kingdoms` keyword in CK3 regions
IhateTrains Nov 17, 2025
854eed1
Add hegemony_keywords keyword to country_rank_map.txt
IhateTrains Nov 21, 2025
a5a186b
Fix Title.DetermineId method limiting the title rank to empire
IhateTrains Nov 22, 2025
cfb0ae6
CleanUpHistory: don't consider hegemonies to be invalid lieges
IhateTrains Nov 22, 2025
f1b5104
[CodeFactor] Apply fixes to commit cfb0ae6
code-factor Nov 22, 2025
3a6ac5f
TODOs for AUH
IhateTrains Nov 29, 2025
835a84a
Merge branch 'master' into feat/ck3-1.18
IhateTrains Nov 29, 2025
2429d78
Merge branch 'master' into feat/ck3-1.18
IhateTrains Dec 19, 2025
3843067
Merge branch 'master' into feat/ck3-1.18
IhateTrains Dec 22, 2025
c77fe41
Merge branch 'master' into feat/ck3-1.18
IhateTrains Dec 31, 2025
8967299
Output CK3 regions
IhateTrains Jan 1, 2026
42ff0be
Merge branch 'master' into feat/ck3-1.18
IhateTrains Jan 1, 2026
d5ba51f
Fix some warnings in tests
IhateTrains Jan 2, 2026
e81b43b
Merge branch 'master' into feat/ck3-1.18
IhateTrains Jan 3, 2026
817f475
Remove handled TODO related to baldness conversion
IhateTrains Jan 3, 2026
ade7e22
Unit tests for eye accessories conversion
IhateTrains Jan 4, 2026
6ea6cf6
Fix formatting of CK3Region.ToString output
IhateTrains Jan 5, 2026
8a02f62
Avoid duplicate region definitions in output mod
IhateTrains Jan 5, 2026
b3c224f
Fix parsing of weight blocks in genes
IhateTrains Jan 5, 2026
0a6ece8
Use ck3-tiger 1.14.0 in integration tests
IhateTrains Jan 5, 2026
46f6a34
Remove usage of obsolete FormatterServices in tests
IhateTrains Jan 5, 2026
eda9075
Link to "Building and running" wiki page in the README
IhateTrains Jan 5, 2026
01d8ec5
Update README.md
IhateTrains Jan 5, 2026
f0e34aa
Add "hegemonies" to Rider's dictionary
IhateTrains Jan 5, 2026
cb05630
Make the branch usable
IhateTrains Jan 5, 2026
2651440
Merge branch 'master' into feat/ck3-1.18
IhateTrains Jan 6, 2026
dad821d
Optimize GroupStaticWaterProvinces
IhateTrains Jan 10, 2026
673cc71
Merge branch 'master' into feat/ck3-1.18
IhateTrains Jan 10, 2026
0439659
set_commander -> assign_commander
IhateTrains Jan 11, 2026
71f60e3
Fix region attributes not being outputted
IhateTrains Jan 11, 2026
0afe125
Merge branch 'master' into feat/ck3-1.18
IhateTrains Jan 11, 2026
13f26fa
Merge branch 'master' into feat/ck3-1.18
IhateTrains Jan 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:

- name: "Download and unzip ck3-tiger"
run: |
Invoke-WebRequest -Uri "https://github.com/amtep/tiger/releases/download/v1.12.0/ck3-tiger-windows-v1.12.0.zip" -OutFile "ck3-tiger.zip"
Invoke-WebRequest -Uri "https://github.com/amtep/tiger/releases/download/v1.14.0/ck3-tiger-windows-v1.14.0.zip" -OutFile "ck3-tiger.zip"
Expand-Archive -Path "ck3-tiger.zip" -DestinationPath "ck3-tiger"
Remove-Item -Path "ck3-tiger.zip"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
using Xunit;
using System;
using System.IO;
using System.Globalization;
using System.Reflection;
using System.Text.RegularExpressions;
using ImperatorRulerTerm = ImperatorToCK3.Imperator.Countries.RulerTerm;

namespace ImperatorToCK3.UnitTests.CK3.Characters;

Expand Down Expand Up @@ -415,4 +419,75 @@ public void ImperatorCharacterNamesCanBeOverriddenByConfigurable() {
// Clean up.
File.Delete(overridesFilePath);
}

[Fact]
public void ChineseDynasticCycleVariablesAreCorrectlyCalculatedForChineseEmpireCountryRulers() {
Date ck3BookmarkDate = new(810, 1, 1);
Date irEndDate = new(780, 1, 1);

var characters = new CharacterCollection();
var holder = new Character("imperator_han_emperor", "Han Emperor", new Date(760, 1, 1), characters) {
FromImperator = true
};
characters.Add(holder);

var landedTitles = new Title.LandedTitles();
var celestialEmpire = landedTitles.Add("e_chinese_empire");
celestialEmpire.SetHolder(holder, ck3BookmarkDate);

var imperatorCountry = new Country(1) { Tag = "HAN" };
SetPrivateProperty(imperatorCountry, nameof(Country.Government), "chinese_empire");
imperatorCountry.TotalPowerBase = 60f;
imperatorCountry.NonLoyalPowerBase = 15f;

var precedingNonChineseStartDate = new Date(700, 3, 1);
var earliestChineseStartDate = new Date(720, 6, 1);
var laterChineseStartDate = new Date(760, 2, 1);

imperatorCountry.RulerTerms.Add(CreateRulerTerm(precedingNonChineseStartDate, "tribal"));
imperatorCountry.RulerTerms.Add(CreateRulerTerm(earliestChineseStartDate, "chinese_empire"));
imperatorCountry.RulerTerms.Add(CreateRulerTerm(laterChineseStartDate, "chinese_empire"));

imperatorCountry.CK3Title = celestialEmpire;
SetPrivateProperty(celestialEmpire, nameof(Title.ImperatorCountry), imperatorCountry);

characters.CalculateChineseDynasticCycleVariables(landedTitles, irEndDate, ck3BookmarkDate);

var effectsField = holder.History.Fields["effects"];
var effectEntry = Assert.Single(effectsField.DateToEntriesDict);
Assert.Equal(ck3BookmarkDate, effectEntry.Key);
var effectString = Assert.IsType<StringOfItem>(Assert.Single(effectEntry.Value).Value).ToString();

var expectedYearsWithGovernment = ck3BookmarkDate.DiffInYears(earliestChineseStartDate) + (earliestChineseStartDate.DiffInYears(precedingNonChineseStartDate) / 2);
var expectedUnrest = imperatorCountry.NonLoyalPowerBase / imperatorCountry.TotalPowerBase;
var effectLines = effectString.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
var yearsLine = Assert.Single(effectLines, line => line.Contains("years_with_government", StringComparison.Ordinal));
var yearsValue = ExtractVariableValue(yearsLine);
Assert.Equal(expectedYearsWithGovernment, yearsValue, precision: 5);
var unrestLine = Assert.Single(effectLines, line => line.Contains("imperator_unrest", StringComparison.Ordinal));
var unrestValue = ExtractVariableValue(unrestLine);
Assert.Equal(expectedUnrest, unrestValue, precision: 5);
}

private static void SetPrivateProperty(object target, string propertyName, object? value) {
var targetType = target.GetType();
var property = targetType.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
Assert.NotNull(property);
var setter = property!.GetSetMethod(nonPublic: true);
Assert.NotNull(setter);
setter!.Invoke(target, new[] { value });
}

private static ImperatorRulerTerm CreateRulerTerm(Date startDate, string governmentId) {
var term = new ImperatorRulerTerm();
SetPrivateProperty(term, nameof(ImperatorRulerTerm.StartDate), startDate);
SetPrivateProperty(term, nameof(ImperatorRulerTerm.Government), governmentId);
return term;
}

private static double ExtractVariableValue(string line) {
var match = Regex.Match(line, "value\\s*=\\s*(?<value>[-+]?[0-9]*\\.?[0-9]+)");
Assert.True(match.Success, $"Could not parse value from line '{line}'.");
return double.Parse(match.Groups["value"].Value, CultureInfo.InvariantCulture);
}
}
Loading
Loading