Skip to content

Commit

Permalink
Encapsulate fields of Imperator.Characters.PaletteCoordinates (#372) …
Browse files Browse the repository at this point in the history
…#patch
  • Loading branch information
IhateTrains authored Nov 7, 2021
1 parent 4cc4ab9 commit 0217714
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 34 deletions.
12 changes: 6 additions & 6 deletions ImperatorToCK3.UnitTests/Imperator/Characters/CharacterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ public void ColorPaletteCoordinatesCanBeExtractedFromDNA() {
var character = ImperatorToCK3.Imperator.Characters.Character.Parse(reader, "42", genesDB);

Assert.NotNull(character.PortraitData);
Assert.Equal((uint)0, character.PortraitData.HairColorPaletteCoordinates.x);
Assert.Equal((uint)0, character.PortraitData.HairColorPaletteCoordinates.y);
Assert.Equal((uint)0, character.PortraitData.SkinColorPaletteCoordinates.x);
Assert.Equal((uint)0, character.PortraitData.SkinColorPaletteCoordinates.y);
Assert.Equal((uint)0, character.PortraitData.EyeColorPaletteCoordinates.x);
Assert.Equal((uint)0, character.PortraitData.EyeColorPaletteCoordinates.y);
Assert.Equal((uint)0, character.PortraitData.HairColorPaletteCoordinates.X);
Assert.Equal((uint)0, character.PortraitData.HairColorPaletteCoordinates.Y);
Assert.Equal((uint)0, character.PortraitData.SkinColorPaletteCoordinates.X);
Assert.Equal((uint)0, character.PortraitData.SkinColorPaletteCoordinates.Y);
Assert.Equal((uint)0, character.PortraitData.EyeColorPaletteCoordinates.X);
Assert.Equal((uint)0, character.PortraitData.EyeColorPaletteCoordinates.Y);
}

[Fact]
Expand Down
36 changes: 18 additions & 18 deletions ImperatorToCK3.UnitTests/Imperator/Characters/PortraitDataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,142 +7,142 @@ public void HairColorXCanBeSetToZero() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAAAAAAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)0, testPortraitData.HairColorPaletteCoordinates.x);
Assert.Equal((uint)0, testPortraitData.HairColorPaletteCoordinates.X);
}
[Fact]
public void HairColorXCanBeSetToMax() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("/wAAAAAAAAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)510, testPortraitData.HairColorPaletteCoordinates.x);
Assert.Equal((uint)510, testPortraitData.HairColorPaletteCoordinates.X);
}

[Fact]
public void HairColorXCanBeSetToArbitraryValue() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("ZAAAAAAAAAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)200, testPortraitData.HairColorPaletteCoordinates.x);
Assert.Equal((uint)200, testPortraitData.HairColorPaletteCoordinates.X);
}

[Fact]
public void HairColorYCanBeSetToZero() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAAAAAAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)0, testPortraitData.HairColorPaletteCoordinates.y);
Assert.Equal((uint)0, testPortraitData.HairColorPaletteCoordinates.Y);
}

[Fact]
public void HairColorYCanBeSetToMax() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AP8AAAAAAAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)510, testPortraitData.HairColorPaletteCoordinates.y);
Assert.Equal((uint)510, testPortraitData.HairColorPaletteCoordinates.Y);
}

[Fact]
public void HairColorYCanBeSetToArbitraryValue() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AGQAAAAAAAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)200, testPortraitData.HairColorPaletteCoordinates.y);
Assert.Equal((uint)200, testPortraitData.HairColorPaletteCoordinates.Y);
}

[Fact]
public void SkinColorXCanBeSetToZero() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAAAAAAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)0, testPortraitData.SkinColorPaletteCoordinates.x);
Assert.Equal((uint)0, testPortraitData.SkinColorPaletteCoordinates.X);
}

[Fact]
public void SkinColorXCanBeSetToMax() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAP8AAAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)510, testPortraitData.SkinColorPaletteCoordinates.x);
Assert.Equal((uint)510, testPortraitData.SkinColorPaletteCoordinates.X);
}

[Fact]
public void SkinColorXCanBeSetToArbitraryValue() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAGQAAAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)200, testPortraitData.SkinColorPaletteCoordinates.x);
Assert.Equal((uint)200, testPortraitData.SkinColorPaletteCoordinates.X);
}

[Fact]
public void SkinColorYCanBeSetToZero() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAAAAAAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)0, testPortraitData.SkinColorPaletteCoordinates.y);
Assert.Equal((uint)0, testPortraitData.SkinColorPaletteCoordinates.Y);
}

[Fact]
public void SkinColorYCanBeSetToMax() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAAD/AAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)510, testPortraitData.SkinColorPaletteCoordinates.y);
Assert.Equal((uint)510, testPortraitData.SkinColorPaletteCoordinates.Y);
}

[Fact]
public void SkinColorYCanBeSetToArbitraryValue() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAABkAAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)200, testPortraitData.SkinColorPaletteCoordinates.y);
Assert.Equal((uint)200, testPortraitData.SkinColorPaletteCoordinates.Y);
}

[Fact]
public void EyeColorXCanBeSetToZero() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAAAAAAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)0, testPortraitData.EyeColorPaletteCoordinates.x);
Assert.Equal((uint)0, testPortraitData.EyeColorPaletteCoordinates.X);
}

[Fact]
public void EyeColorXCanBeSetToMax() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAAAAAAD/AAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)510, testPortraitData.EyeColorPaletteCoordinates.x);
Assert.Equal((uint)510, testPortraitData.EyeColorPaletteCoordinates.X);
}

[Fact]
public void EyeColorXCanBeSetToArbitraryValue() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAAAAAABkAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)200, testPortraitData.EyeColorPaletteCoordinates.x);
Assert.Equal((uint)200, testPortraitData.EyeColorPaletteCoordinates.X);
}

[Fact]
public void EyeColorYCanBeSetToZero() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAAAAAAAAAAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)0, testPortraitData.EyeColorPaletteCoordinates.y);
Assert.Equal((uint)0, testPortraitData.EyeColorPaletteCoordinates.Y);
}

[Fact]
public void EyeColorYCanBeSetToMax() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAAAAAAAA/wAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)510, testPortraitData.EyeColorPaletteCoordinates.y);
Assert.Equal((uint)510, testPortraitData.EyeColorPaletteCoordinates.Y);
}

[Fact]
public void EyeColorYCanBeSetToArbitraryValue() {
var genesDB = new ImperatorToCK3.Imperator.Genes.GenesDB();
var testPortraitData = new ImperatorToCK3.Imperator.Characters.PortraitData("AAAAAAAAAAAAZAAAAH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", genesDB);

Assert.Equal((uint)200, testPortraitData.EyeColorPaletteCoordinates.y);
Assert.Equal((uint)200, testPortraitData.EyeColorPaletteCoordinates.Y);
}
}
}
5 changes: 3 additions & 2 deletions ImperatorToCK3/Imperator/Characters/PaletteCoordinates.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace ImperatorToCK3.Imperator.Characters {
public class PaletteCoordinates {
public uint x = 256; // palettes are 512x512
public uint y = 256;
// palettes are 512x512
public uint X { get; set; } = 256;
public uint Y { get; set; } = 256;
}
}
12 changes: 6 additions & 6 deletions ImperatorToCK3/Imperator/Characters/PortraitData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ public PortraitData(string dnaString, Genes.GenesDB genesDB, string ageSexString
const int eyeColorPaletteYIndex = 9;

// hair
HairColorPaletteCoordinates.x = (uint)decodedDnaStr[hairColorPaletteXIndex] * 2;
HairColorPaletteCoordinates.y = (uint)decodedDnaStr[hairColorPaletteYIndex] * 2;
HairColorPaletteCoordinates.X = (uint)decodedDnaStr[hairColorPaletteXIndex] * 2;
HairColorPaletteCoordinates.Y = (uint)decodedDnaStr[hairColorPaletteYIndex] * 2;
// skin
SkinColorPaletteCoordinates.x = (uint)decodedDnaStr[skinColorPaletteXIndex] * 2;
SkinColorPaletteCoordinates.y = (uint)decodedDnaStr[skinColorPaletteYIndex] * 2;
SkinColorPaletteCoordinates.X = (uint)decodedDnaStr[skinColorPaletteXIndex] * 2;
SkinColorPaletteCoordinates.Y = (uint)decodedDnaStr[skinColorPaletteYIndex] * 2;
// eyes
EyeColorPaletteCoordinates.x = (uint)decodedDnaStr[eyeColorPaletteXIndex] * 2;
EyeColorPaletteCoordinates.y = (uint)decodedDnaStr[eyeColorPaletteYIndex] * 2;
EyeColorPaletteCoordinates.X = (uint)decodedDnaStr[eyeColorPaletteXIndex] * 2;
EyeColorPaletteCoordinates.Y = (uint)decodedDnaStr[eyeColorPaletteYIndex] * 2;

// accessory genes
const uint colorGenesBytes = 12;
Expand Down
6 changes: 4 additions & 2 deletions ImperatorToCK3/Outputter/CharacterOutputter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ public static void OutputCharacter(StreamWriter output, Character character, Dat
}

//output father and mother
if (character.Father is not null)
if (character.Father is not null) {
output.WriteLine($"\tfather = {character.Father.Id}");
if (character.Mother is not null)
}
if (character.Mother is not null) {
output.WriteLine($"\tmother = {character.Mother.Id}");
}

// output spouse
// TODO: output add_spouse with earlier date if the pair has a born or unborn child
Expand Down

0 comments on commit 0217714

Please sign in to comment.