From d23038f53cca7045a7db3535e90d7f59bb32c373 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 17 Oct 2026 18:55:16 +0200 Subject: [PATCH] Assembly is the maker's: re-land of h1 on 0f5def17 (net diff of ae300c6a..5187a59d) Applies the net diff of eureka/aetheria-release-assembly-from-maker (5187a59d) without its catalog blob and RunStartTests residue, git apply -3, overlaps resolved on master's side. 066fb581's message ('git log --oneline -1') was a heredoc slip; the old branch stays as it is. Drops the Rarity = fixture member from the tests master added since ae300c6a. Faction keys 19-20 here are h1's; the next commit reshapes them to one Assembly at 19. Co-Authored-By: Claude Opus 5.5 --- Assets/Scripts/ServerShared/Corporations.cs | 9 ++ Assets/Scripts/ServerShared/ItemManager.cs | 23 +--- Assets/Scripts/ServerShared/Provenance.cs | 10 +- Assets/Scripts/ServerShared/Settings.cs | 1 - .../AssemblyFromMakerCatalogTests.cs | 35 ++++++ .../AssemblyFromMakerCommandTests.cs | 87 +++++++++++++ .../AssemblyFromMakerTests.cs | 118 ++++++++++++++++++ tests/Aetheria.Shared.Tests/BrownoutTests.cs | 2 +- .../Aetheria.Shared.Tests/CatalogRoleTests.cs | 2 +- .../ConditionRatioTests.cs | 2 +- .../ConsumableSupplyTests.cs | 13 +- .../ConsumablesFirstSetTests.cs | 2 +- .../ContactRevealTests.cs | 2 +- tests/Aetheria.Shared.Tests/ContactTests.cs | 2 +- tests/Aetheria.Shared.Tests/DrawnPoseTests.cs | 2 +- tests/Aetheria.Shared.Tests/EmissionTests.cs | 6 +- .../FireAuthorityTests.cs | 2 +- .../FireControlCut11Tests.cs | 2 +- .../FireControlCut123Tests.cs | 2 +- .../FireControlCut124Tests.cs | 2 +- .../FireControlCut12Tests.cs | 2 +- .../FireControlCut4Tests.cs | 2 +- .../FireControlCut5Tests.cs | 2 +- .../FireControlCut6Tests.cs | 2 +- .../FireControlCut6cTests.cs | 2 +- .../FireControlCut6dTests.cs | 2 +- .../FireControlCut7Tests.cs | 4 +- .../FireControlCut8Tests.cs | 2 +- .../FireControlCut9Tests.cs | 2 +- .../FireControlPerWeaponTests.cs | 2 +- .../Aetheria.Shared.Tests/FireControlTests.cs | 2 +- tests/Aetheria.Shared.Tests/FlightTests.cs | 2 +- .../FloatingBodyTests.cs | 4 +- tests/Aetheria.Shared.Tests/FlowFieldTests.cs | 2 +- .../GravitySubtractTests.cs | 2 +- .../HeatResponseTests.cs | 2 +- .../IffAndCombatTests.cs | 2 +- .../InputCapacitorTests.cs | 2 +- .../InspectionScannerCatalogTests.cs | 2 +- .../LaunchSuppressorCatalogTests.cs | 2 +- tests/Aetheria.Shared.Tests/LayerTests.cs | 2 +- tests/Aetheria.Shared.Tests/LoadoutTests.cs | 12 +- .../Aetheria.Shared.Tests/LockWarningTests.cs | 2 +- tests/Aetheria.Shared.Tests/LootTests.cs | 2 +- tests/Aetheria.Shared.Tests/MineTests.cs | 2 +- .../Aetheria.Shared.Tests/MiningCut1Tests.cs | 2 +- .../Aetheria.Shared.Tests/MiningCut2Tests.cs | 2 +- .../Aetheria.Shared.Tests/MiningCut3Tests.cs | 2 +- tests/Aetheria.Shared.Tests/PaintModeTests.cs | 2 +- tests/Aetheria.Shared.Tests/PickupTests.cs | 2 +- .../PopulatedRadiusTests.cs | 2 +- .../PotentialOwnerTests.cs | 2 +- tests/Aetheria.Shared.Tests/PowerBusTests.cs | 2 +- .../Aetheria.Shared.Tests/PowerCurveTests.cs | 2 +- tests/Aetheria.Shared.Tests/PowerTierTests.cs | 2 +- .../RoleAuthoringTests.cs | 4 +- tests/Aetheria.Shared.Tests/RunSaveTests.cs | 2 +- .../ShieldReserveTests.cs | 2 +- tests/Aetheria.Shared.Tests/SignatureTests.cs | 2 +- .../StatResolverTests.cs | 2 +- .../TargetingSystemTests.cs | 2 +- .../ThrottleLockTests.cs | 2 +- .../Aetheria.Shared.Tests/VapourCloudTests.cs | 2 +- .../ZonePlacedAtBuildTests.cs | 2 +- tests/Aetheria.Shared.Tests/ZoneWorlds.cs | 2 +- tools/AetherDb/AssemblyFromMakerCommand.cs | 70 +++++++++++ tools/AetherDb/Program.cs | 7 +- 67 files changed, 409 insertions(+), 98 deletions(-) create mode 100644 tests/Aetheria.Shared.Tests/AssemblyFromMakerCatalogTests.cs create mode 100644 tests/Aetheria.Shared.Tests/AssemblyFromMakerCommandTests.cs create mode 100644 tests/Aetheria.Shared.Tests/AssemblyFromMakerTests.cs create mode 100644 tools/AetherDb/AssemblyFromMakerCommand.cs diff --git a/Assets/Scripts/ServerShared/Corporations.cs b/Assets/Scripts/ServerShared/Corporations.cs index c1e69fcca..a17263933 100644 --- a/Assets/Scripts/ServerShared/Corporations.cs +++ b/Assets/Scripts/ServerShared/Corporations.cs @@ -63,6 +63,15 @@ public class Faction // The faction's rules of engagement; null fights as FactionDoctrine.Default. [Inspectable, JsonProperty("doctrine"), Key(17)] public FactionDoctrine Doctrine; + + // The maker's final-assembly technology (mean) and quality control (deviation): the distribution every lot of + // theirs draws its own quality from, and the hard ceiling on every one of its roles (quality-lean-assembly-hard-ceiling). + // Key 18 is reserved for Livery and 16 for Relations. + [Inspectable, JsonProperty("assemblyMean"), Key(19)] + public float AssemblyMean = .5f; + + [Inspectable, JsonProperty("assemblyDeviation"), Key(20)] + public float AssemblyDeviation = .15f; } [CultDocument("aetheria.namefile", "1"), Inspectable, MessagePackObject] diff --git a/Assets/Scripts/ServerShared/ItemManager.cs b/Assets/Scripts/ServerShared/ItemManager.cs index 884179e4e..2904c35f1 100644 --- a/Assets/Scripts/ServerShared/ItemManager.cs +++ b/Assets/Scripts/ServerShared/ItemManager.cs @@ -117,31 +117,20 @@ public class ItemManager return (int) (GameplaySettings.QualityPriceModifier.Evaluate(GetLot(item).Quality) * data.Price); } - // The tier roll every mint applies, whether or not the lot fills roles. - public float RollQuality() - { - var quality = Random.NextFloat(); - var tier = GameplaySettings.Tiers[0]; - foreach (var t in GameplaySettings.Tiers) - { - if (t.Rarity > quality) - tier = t; - } - - return tier.Quality; - } - - // Builds one of a manufacturer's branded products: the unit's own workmanship rolled as before, and each of - // the design's roles filled with a part whose quality is drawn from that manufacturer's distribution for it. + // Builds one of a manufacturer's branded products (quality-is-assembly-over-supply-chain): the unit's own quality is its + // final assembly, drawn from the maker's assembly distribution, and each of the design's roles is filled with a part whose + // quality is drawn from the product's distribution for it. A maker the catalog cannot resolve assembles at a new Faction's + // defaults. public int CreateLot(FactionProductData product) { var design = ItemData.Get(product.Design); + var maker = ItemData.Get(product.Manufacturer) ?? new Faction(); var lot = new Lot { Design = ItemData.RefOf(design), Origin = new Attributed { Faction = product.Manufacturer }, Product = ItemData.RefOf(product), - Quality = RollQuality(), + Quality = clamp(Random.NextGaussian(maker.AssemblyMean, maker.AssemblyDeviation), .01f, 1), Roles = new List() }; if (design.Roles != null) diff --git a/Assets/Scripts/ServerShared/Provenance.cs b/Assets/Scripts/ServerShared/Provenance.cs index 80e8e31f0..adf83c308 100644 --- a/Assets/Scripts/ServerShared/Provenance.cs +++ b/Assets/Scripts/ServerShared/Provenance.cs @@ -72,18 +72,20 @@ public class Lot // (console give, presets, extracted), which brand their maker only. [Key(4)] public CultRecordRef Product; - // The quality a stat reads for one of the design's roles. An unnamed role, a design without roles, and a lot - // minted before roles existed all fall back to the lot's own workmanship. + // The quality a stat reads for one of the design's roles: the part's, capped by the lot's own final assembly + // (quality-lean-assembly-hard-ceiling), so a part better than its assembly is worth the assembly. An unnamed role, a + // design without roles, and a lot minted before roles existed all fall back to the lot's own workmanship. public float QualityForRole(string role) { if (string.IsNullOrEmpty(role) || Roles == null) return Quality; foreach (var fill in Roles) - if (fill.Role == role) return fill.Quality; + if (fill.Role == role) return Math.Min(fill.Quality, Quality); return Quality; } } -// One filled slot: the design's role name and how good the part that went into it turned out to be. +// One filled slot: the design's role name and how good the part that went into it turned out to be. Stats read it through +// Lot.QualityForRole, capped by the lot's assembly; the raw value is kept for disassembly (named-components-after-demo). [MessagePackObject] public class RoleFill { diff --git a/Assets/Scripts/ServerShared/Settings.cs b/Assets/Scripts/ServerShared/Settings.cs index 85d1f3d96..1554f48e1 100644 --- a/Assets/Scripts/ServerShared/Settings.cs +++ b/Assets/Scripts/ServerShared/Settings.cs @@ -306,5 +306,4 @@ public class RarityTier public string Name; public float Quality; public float3 Color; - public float Rarity; } \ No newline at end of file diff --git a/tests/Aetheria.Shared.Tests/AssemblyFromMakerCatalogTests.cs b/tests/Aetheria.Shared.Tests/AssemblyFromMakerCatalogTests.cs new file mode 100644 index 000000000..fbd2698e6 --- /dev/null +++ b/tests/Aetheria.Shared.Tests/AssemblyFromMakerCatalogTests.cs @@ -0,0 +1,35 @@ +using System; +using System.Linq; +using System.Reflection; +using MessagePack; +using Xunit; + +// The shipped catalog carries each maker's derived assembly, and the Faction format pins its wire positions +// (aetheria-release, cut assembly-from-maker). +public sealed class AssemblyFromMakerCatalogTests +{ + [Fact] + public void ShippedCatalogCarriesDerivation() + { + using var cache = RestoredHullsTests.OpenCatalog(); + var products = cache.GetAll().Where(p => p.Roles.Count > 0).ToArray(); + var makers = products.Select(p => p.Manufacturer.Key).Distinct().ToArray(); + Assert.NotEmpty(makers); + foreach (var key in makers) + { + var roles = products.Where(p => p.Manufacturer.Key.Equals(key)).SelectMany(p => p.Roles).ToArray(); + var faction = cache.Get(key); + Assert.Equal(Math.Round(roles.Average(r => r.Mean), 2), faction.AssemblyMean, 2); + Assert.Equal(Math.Round(roles.Average(r => r.StandardDeviation), 2), faction.AssemblyDeviation, 2); + } + } + + // 16 is reserved for Relations, 17 is Doctrine, 18 is reserved for Livery. + [Fact] + public void AssemblyFieldsSitAtKeys19And20() + { + int KeyOf(string field) => typeof(Faction).GetField(field).GetCustomAttribute().IntKey.Value; + Assert.Equal(19, KeyOf(nameof(Faction.AssemblyMean))); + Assert.Equal(20, KeyOf(nameof(Faction.AssemblyDeviation))); + } +} diff --git a/tests/Aetheria.Shared.Tests/AssemblyFromMakerCommandTests.cs b/tests/Aetheria.Shared.Tests/AssemblyFromMakerCommandTests.cs new file mode 100644 index 000000000..f54af3a34 --- /dev/null +++ b/tests/Aetheria.Shared.Tests/AssemblyFromMakerCommandTests.cs @@ -0,0 +1,87 @@ +using System; +using System.IO; +using System.Linq; +using GameCult.Caching; +using Xunit; + +// assembly-from-maker (aetheria-release, cut assembly-from-maker): each maker's assembly distribution is derived from the +// roles of the products it manufactures. +public sealed class AssemblyFromMakerCommandTests : IDisposable +{ + private readonly string _root = Path.Combine(Path.GetTempPath(), "aetheria-assembly-cmd-" + Guid.NewGuid().ToString("N")); + private string Catalog => Path.Combine(_root, "Aetheria.cc"); + + public AssemblyFromMakerCommandTests() => Directory.CreateDirectory(_root); + public void Dispose() => Directory.Delete(_root, true); + + private void Seed() + { + using var cache = AetheriaStores.Open(Catalog, catalogWritable: true); + cache.Upsert(new VerseGrammar { Revision = 1 }); + var maker = cache.Upsert(new Faction { Name = "Maker" }); + cache.Upsert(new Faction { Name = "Bystander", AssemblyMean = .9f, AssemblyDeviation = .01f }); + var gear = cache.Upsert(new GearData { Name = "Lamp", Hardpoint = HardpointType.Sensors, Shape = new Shape(), Price = 10 }); + var design = new CultRecordRef(gear.Key); + // Two products, three roles: the mean is over roles (.2, .4, .9 -> .5), the deviation likewise (.1, .1, .4 -> .2). + cache.Upsert(new FactionProductData + { + Name = "A", Design = design, Manufacturer = maker, + Roles = { new ProductRole { Role = "x", Mean = .2f, StandardDeviation = .1f }, new ProductRole { Role = "y", Mean = .4f, StandardDeviation = .1f } } + }); + cache.Upsert(new FactionProductData + { + Name = "B", Design = design, Manufacturer = maker, + Roles = { new ProductRole { Role = "x", Mean = .9f, StandardDeviation = .4f } } + }); + // Figures that need two decimals: (.2 + .27 + .31) / 3 = .26 and (.11 + .17 + .2) / 3 = .16. + var fine = cache.Upsert(new Faction { Name = "Fine" }); + cache.Upsert(new FactionProductData + { + Name = "C", Design = design, Manufacturer = fine, + Roles = + { + new ProductRole { Role = "x", Mean = .2f, StandardDeviation = .11f }, + new ProductRole { Role = "y", Mean = .27f, StandardDeviation = .17f }, + new ProductRole { Role = "z", Mean = .31f, StandardDeviation = .2f } + } + }); + cache.FlushAsync().Wait(); + } + + private string Run(bool apply) + { + using var cache = AetheriaStores.Open(Catalog, catalogWritable: apply); + var output = new StringWriter(); + Assert.Equal(0, AssemblyFromMakerCommand.Run(cache, apply, output)); + cache.FlushAsync().Wait(); + return output.ToString(); + } + + [Fact] + public void DryRunWritesNothingApplyIsIdempotent() + { + Seed(); + var before = File.ReadAllBytes(Catalog); + Assert.Contains("Maker", Run(apply: false)); + Assert.Equal(before, File.ReadAllBytes(Catalog)); + + Run(apply: true); + using (var cache = AetheriaStores.Open(Catalog)) + { + var maker = cache.GetAll().Single(f => f.Name == "Maker"); + Assert.Equal(.5f, maker.AssemblyMean, 3); + Assert.Equal(.2f, maker.AssemblyDeviation, 3); + var fine = cache.GetAll().Single(f => f.Name == "Fine"); + Assert.Equal(.26f, fine.AssemblyMean, 3); + Assert.Equal(.16f, fine.AssemblyDeviation, 3); + // A faction that manufactures nothing is written the field defaults. + var bystander = cache.GetAll().Single(f => f.Name == "Bystander"); + Assert.Equal(.5f, bystander.AssemblyMean, 3); + Assert.Equal(.15f, bystander.AssemblyDeviation, 3); + } + + var written = File.ReadAllBytes(Catalog); + Assert.Contains("No changes", Run(apply: true)); + Assert.Equal(written, File.ReadAllBytes(Catalog)); + } +} diff --git a/tests/Aetheria.Shared.Tests/AssemblyFromMakerTests.cs b/tests/Aetheria.Shared.Tests/AssemblyFromMakerTests.cs new file mode 100644 index 000000000..17df5331f --- /dev/null +++ b/tests/Aetheria.Shared.Tests/AssemblyFromMakerTests.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using GameCult.Caching; +using Xunit; + +// Assembly is the maker's (aetheria-release, cut assembly-from-maker; rulings quality-is-assembly-over-supply-chain, +// quality-lean-assembly-hard-ceiling): a branded lot's own quality is drawn from its manufacturer's assembly distribution, +// and every role a stat reads is min(part, assembly). Lots here come from CreateLot(product), the production mint. +public sealed class AssemblyFromMakerTests : IDisposable +{ + private readonly string _root = Path.Combine(Path.GetTempPath(), "aetheria-assembly-" + Guid.NewGuid().ToString("N")); + private readonly CultCache _cache; + private readonly ItemManager _items; + private readonly CultRecordRef _lens; + + public AssemblyFromMakerTests() + { + Directory.CreateDirectory(_root); + _cache = AetheriaStores.Open(Path.Combine(_root, "Aetheria.cc"), catalogWritable: true); + var gear = _cache.Upsert(new GearData + { + Name = "Lensed", Hardpoint = HardpointType.Sensors, Shape = new Shape(), Price = 10, + Roles = { new ItemRole { Name = "lens" } } + }); + _lens = new CultRecordRef(gear.Key); + _items = new ItemManager(_cache, new ProvenanceLedger(), RunSaveTests.TestSettings(), _ => { }); + } + + public void Dispose() + { + _cache.Dispose(); + Directory.Delete(_root, true); + } + + private FactionProductData Product(string name, Faction maker, float partMean, float partDeviation = 0) + { + var makerRef = maker == null ? default : _cache.Upsert(maker); + _cache.Upsert(new FactionProductData + { + Name = name, Design = _lens, Manufacturer = makerRef, + Roles = { new ProductRole { Role = "lens", Mean = partMean, StandardDeviation = partDeviation } } + }); + return _cache.GetAll().Single(p => p.Name == name); + } + + private float[] Mint(FactionProductData product, int count) => + Enumerable.Range(0, count).Select(_ => _items.Lots[_items.CreateLot(product)].Quality).ToArray(); + + // Two makers, assembly .3 and .8: each lot's own quality follows its manufacturer, not a product-blind roll. + [Fact] + public void LotQualityFollowsMaker() + { + var low = Product("Low", new Faction { Name = "Low Maker", AssemblyMean = .3f, AssemblyDeviation = .02f }, .5f); + var high = Product("High", new Faction { Name = "High Maker", AssemblyMean = .8f, AssemblyDeviation = .02f }, .5f); + var lows = Mint(low, 300); + var highs = Mint(high, 300); + Assert.InRange(lows.Average(), .27f, .33f); + Assert.InRange(highs.Average(), .77f, .83f); + Assert.True(lows.Max() < highs.Min(), "a lot read the other maker's band"); + } + + // Quality control is the maker's too: the same mean, a wide and a tight deviation, and the spread of their lots follows. + [Fact] + public void LotSpreadFollowsMakerDeviation() + { + var wide = Mint(Product("Wide", new Faction { Name = "Wide Maker", AssemblyMean = .5f, AssemblyDeviation = .2f }, .5f), 400); + var tight = Mint(Product("Tight", new Faction { Name = "Tight Maker", AssemblyMean = .5f, AssemblyDeviation = .02f }, .5f), 400); + double Spread(float[] lots) => Math.Sqrt(lots.Select(q => Math.Pow(q - lots.Average(), 2)).Average()); + Assert.InRange(Spread(wide), .15, .25); + Assert.InRange(Spread(tight), .01, .04); + } + + // A maker the catalog cannot resolve assembles at a new Faction's defaults. + [Fact] + public void UnresolvedMakerAssemblesAtDefaults() + { + var orphan = Product("Orphan", null, .5f); + var defaults = new Faction(); + Assert.InRange(Mint(orphan, 400).Average(), defaults.AssemblyMean - .03f, defaults.AssemblyMean + .03f); + } + + // The ceiling at the mint: a part drawn at .9 in an assembly of .4 reads .4; a part at .2 in the same assembly reads .2. + [Fact] + public void RoleCappedByAssembly() + { + var maker = new Faction { Name = "Capped", AssemblyMean = .4f, AssemblyDeviation = 0 }; + var over = _items.Lots[_items.CreateLot(Product("Over", maker, .9f))]; + var under = _items.Lots[_items.CreateLot(Product("Under", maker, .2f))]; + Assert.Equal(.4f, over.Quality, 3); + Assert.Equal(.4f, over.QualityForRole("lens"), 3); + Assert.Equal(.2f, under.QualityForRole("lens"), 3); + // The raw part is kept for disassembly (named-components-after-demo). + Assert.Equal(.9f, over.Roles.Single().Quality, 3); + } + + // The fallbacks still read the assembly: an unnamed role, an unrolled role, and a lot with no roles. + [Fact] + public void FallbacksReadTheAssembly() + { + var lot = new Lot { Quality = .4f, Roles = new List { new RoleFill { Role = "lens", Quality = .9f } } }; + Assert.Equal(.4f, lot.QualityForRole(null), 3); + Assert.Equal(.4f, lot.QualityForRole(""), 3); + Assert.Equal(.4f, lot.QualityForRole("ghost"), 3); + Assert.Equal(.4f, new Lot { Quality = .4f }.QualityForRole("lens"), 3); + } + + // A Quality term on a role with part .9 and assembly .4 evaluates as if quality were .4, on a real minted instance. + [Fact] + public void QualityTermReadsCeiling() + { + var maker = new Faction { Name = "Capped", AssemblyMean = .4f, AssemblyDeviation = 0 }; + var instance = (EquippableItem) _items.CreateInstance(_items.CreateLot(Product("Over", maker, .9f))); + var stat = new PerformanceStat { Min = 0, Max = 1, Terms = { new StatTerm { Source = StatSource.Quality, Exponent = 1, Role = "lens" } } }; + Assert.Equal(.4f, _items.Evaluate(stat, instance), 3); + } +} diff --git a/tests/Aetheria.Shared.Tests/BrownoutTests.cs b/tests/Aetheria.Shared.Tests/BrownoutTests.cs index c901648e7..b48657e33 100644 --- a/tests/Aetheria.Shared.Tests/BrownoutTests.cs +++ b/tests/Aetheria.Shared.Tests/BrownoutTests.cs @@ -52,7 +52,7 @@ public sealed class BrownoutTests : IDisposable private static GameplaySettings Settings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tests/Aetheria.Shared.Tests/CatalogRoleTests.cs b/tests/Aetheria.Shared.Tests/CatalogRoleTests.cs index 0a452491f..b50e0142d 100644 --- a/tests/Aetheria.Shared.Tests/CatalogRoleTests.cs +++ b/tests/Aetheria.Shared.Tests/CatalogRoleTests.cs @@ -322,7 +322,7 @@ public sealed class CatalogRoleTests private sealed class DisciplineContext : IStatContext { public DisciplineContext(float discipline) => - Lot = new Lot { Quality = .123f, Roles = new List { new RoleFill { Role = "emission-discipline", Quality = discipline } } }; + Lot = new Lot { Quality = 1f, Roles = new List { new RoleFill { Role = "emission-discipline", Quality = discipline } } }; public Lot Lot { get; } public float HeatFactor(float exponent) => 1f; public float DurabilityFactor(float exponent) => 1f; diff --git a/tests/Aetheria.Shared.Tests/ConditionRatioTests.cs b/tests/Aetheria.Shared.Tests/ConditionRatioTests.cs index e294b942f..c3a5ddcde 100644 --- a/tests/Aetheria.Shared.Tests/ConditionRatioTests.cs +++ b/tests/Aetheria.Shared.Tests/ConditionRatioTests.cs @@ -27,7 +27,7 @@ public sealed class ConditionRatioTests : IDisposable private static GameplaySettings Settings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tests/Aetheria.Shared.Tests/ConsumableSupplyTests.cs b/tests/Aetheria.Shared.Tests/ConsumableSupplyTests.cs index cd968e885..78cbf6f0f 100644 --- a/tests/Aetheria.Shared.Tests/ConsumableSupplyTests.cs +++ b/tests/Aetheria.Shared.Tests/ConsumableSupplyTests.cs @@ -334,14 +334,15 @@ public sealed class ConsumableSupplyTests : IDisposable .Concat(Enumerable.Range(0, 4).Select(_ => rig.Items.Random.NextFloat())).ToArray(); } - // What the plain catalog leaves in both generators' Random, measured on the tree before consumables existed - // (origin/master d4a27def, the same fixture and seeds), plus the one product draw each of the three generated - // ships makes for its tractor beam (loot-2): with that draw taken out the tree leaves the d4a27def values - // 0.85624266, 0.037778974, 0.7931649, 0.3596493, 0.17511952, 0.6642336, 0.31897342, 0.5977364. The gated and - // plain catalogs agreeing is not enough: a step that drew unconditionally would draw in both. This pins the value itself. + // What the plain catalog leaves in both generators' Random: the d4a27def measurement (before consumables existed, the + // same fixture and seeds) plus the one product draw each of the three generated ships makes for its tractor beam + // (loot-2), re-measured when a lot's assembly became a Gaussian draw from its maker (assembly-from-maker), which + // consumes the item stream differently from the tier roll it replaced; the generator's own stream (the first four + // values) is unchanged. The gated and plain catalogs agreeing is not enough: a step that drew unconditionally would + // draw in both. This pins the value itself. var beforeConsumables = new[] { - 0.3596493f, 0.03616327f, 0.8790466f, 0.16682059f, 0.5977364f, 0.08633745f, 0.2869571f, 0.6890472f + 0.3596493f, 0.03616327f, 0.8790466f, 0.16682059f, 0.55950844f, 0.87309176f, 0.7170387f, 0.8490041f }; var plainAfter = AfterGeneration(plain); Assert.Equal(beforeConsumables, plainAfter); diff --git a/tests/Aetheria.Shared.Tests/ConsumablesFirstSetTests.cs b/tests/Aetheria.Shared.Tests/ConsumablesFirstSetTests.cs index d43fb47be..300c2f9b9 100644 --- a/tests/Aetheria.Shared.Tests/ConsumablesFirstSetTests.cs +++ b/tests/Aetheria.Shared.Tests/ConsumablesFirstSetTests.cs @@ -146,7 +146,7 @@ public sealed class ConsumablesFirstSetTests var second = design.Roles[1].Name; var lot = Ship.ItemManager.Lots.Add(new Lot { - Design = Cache.RefOf(design), Origin = new Attributed(), Quality = .5f, + Design = Cache.RefOf(design), Origin = new Attributed(), Quality = 1f, Roles = new List { new RoleFill { Role = first, Quality = propellantOrNozzleQuality }, diff --git a/tests/Aetheria.Shared.Tests/ContactRevealTests.cs b/tests/Aetheria.Shared.Tests/ContactRevealTests.cs index 6ea4af3da..bdca8008f 100644 --- a/tests/Aetheria.Shared.Tests/ContactRevealTests.cs +++ b/tests/Aetheria.Shared.Tests/ContactRevealTests.cs @@ -176,7 +176,7 @@ public sealed partial class ContactRevealTests : IDisposable _items = new ItemManager(_openCache, ledger, new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/ContactTests.cs b/tests/Aetheria.Shared.Tests/ContactTests.cs index bccd2a90d..adceb4b98 100644 --- a/tests/Aetheria.Shared.Tests/ContactTests.cs +++ b/tests/Aetheria.Shared.Tests/ContactTests.cs @@ -90,7 +90,7 @@ public sealed class ContactTests : IDisposable var settings = new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, FiringArc = 170, CommitHorizon = .5f, SchematicCellSize = 2f, ContactRestitution = restitution diff --git a/tests/Aetheria.Shared.Tests/DrawnPoseTests.cs b/tests/Aetheria.Shared.Tests/DrawnPoseTests.cs index acc7f8f72..e2da6ea72 100644 --- a/tests/Aetheria.Shared.Tests/DrawnPoseTests.cs +++ b/tests/Aetheria.Shared.Tests/DrawnPoseTests.cs @@ -86,7 +86,7 @@ public sealed class DrawnPoseTests : IDisposable var items = new ItemManager(cache, ledger, new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), ShipLayerHeight = ShipLayerHeight, OrbitalLayerHeight = OrbitalLayerHeight }, _ => { }); diff --git a/tests/Aetheria.Shared.Tests/EmissionTests.cs b/tests/Aetheria.Shared.Tests/EmissionTests.cs index c6e2927b8..831f6f520 100644 --- a/tests/Aetheria.Shared.Tests/EmissionTests.cs +++ b/tests/Aetheria.Shared.Tests/EmissionTests.cs @@ -316,7 +316,7 @@ public sealed partial class ContactRevealTests } // A catalog-style sensor reads its intercept factor through the lot the ship equips it from: the lot's - // emission-discipline fill is the input (the workmanship is a decoy at .123), so a Sensor that read only the quiet or only + // emission-discipline fill is the input (the workmanship, at 1, is a decoy), so a Sensor that read only the quiet or only // the loud end, or the workmanship, reads the wrong number. The expectations are lerp(.5, 2, q^log2(3)): a middling part // reads 1, the Lucent mean (.2) reads about .62 and the Finch mean (.8) about 1.55. [Theory] @@ -325,7 +325,7 @@ public sealed partial class ContactRevealTests [InlineData(.8f, 1.5534f)] public void ASensorReadsItsInterceptFactorFromItsLotsEmissionDiscipline(float discipline, float expected) { - var lot = _items.CreateLot(_openCache.GetByName("Disciplined"), _maker, .123f); + var lot = _items.CreateLot(_openCache.GetByName("Disciplined"), _maker, 1f); _items.Lots[lot].Roles = new List { new RoleFill { Role = "emission-discipline", Quality = discipline } }; _preparedLots["Disciplined"] = lot; var ship = Add(float3(0, 0, 0), new[] { "Disciplined" }); @@ -345,7 +345,7 @@ public sealed partial class ContactRevealTests public void AnEmissionIsHeardWithinRangeOverTheLotsAlpha(bool ping, float distance, bool heard) { var design = ping ? "Disciplined" : "DisciplinedScanner"; - var lot = _items.CreateLot(_openCache.GetByName(design), _maker, .123f); + var lot = _items.CreateLot(_openCache.GetByName(design), _maker, 1f); _items.Lots[lot].Roles = new List { new RoleFill { Role = "emission-discipline", Quality = .2f } }; _preparedLots[design] = lot; var third = Add(float3(-distance, 0, 0), new[] { "Eye" }); diff --git a/tests/Aetheria.Shared.Tests/FireAuthorityTests.cs b/tests/Aetheria.Shared.Tests/FireAuthorityTests.cs index fb919c2ec..8323bd7a9 100644 --- a/tests/Aetheria.Shared.Tests/FireAuthorityTests.cs +++ b/tests/Aetheria.Shared.Tests/FireAuthorityTests.cs @@ -37,7 +37,7 @@ public sealed class FireAuthorityTests : IDisposable private static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, FiringArc = 170, diff --git a/tests/Aetheria.Shared.Tests/FireControlCut11Tests.cs b/tests/Aetheria.Shared.Tests/FireControlCut11Tests.cs index 5dc373390..9e9d74fce 100644 --- a/tests/Aetheria.Shared.Tests/FireControlCut11Tests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlCut11Tests.cs @@ -37,7 +37,7 @@ public sealed class FireControlCut11Tests : IDisposable private static GameplaySettings TestSettings(float schematicCellSize = 1f) => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/FireControlCut123Tests.cs b/tests/Aetheria.Shared.Tests/FireControlCut123Tests.cs index 670b96490..7e49ec3c7 100644 --- a/tests/Aetheria.Shared.Tests/FireControlCut123Tests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlCut123Tests.cs @@ -39,7 +39,7 @@ public sealed class FireControlCut123Tests : IDisposable private static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/FireControlCut124Tests.cs b/tests/Aetheria.Shared.Tests/FireControlCut124Tests.cs index 4bcd5b034..e6d8f5a0e 100644 --- a/tests/Aetheria.Shared.Tests/FireControlCut124Tests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlCut124Tests.cs @@ -41,7 +41,7 @@ public sealed partial class FireControlCut124Tests : IDisposable private static GameplaySettings TestSettings(float commitHorizon = .5f) => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/FireControlCut12Tests.cs b/tests/Aetheria.Shared.Tests/FireControlCut12Tests.cs index 1c343c00b..adbcac5ef 100644 --- a/tests/Aetheria.Shared.Tests/FireControlCut12Tests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlCut12Tests.cs @@ -38,7 +38,7 @@ public sealed class FireControlCut12Tests : IDisposable private static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/FireControlCut4Tests.cs b/tests/Aetheria.Shared.Tests/FireControlCut4Tests.cs index 469ebc75b..08ba48d0d 100644 --- a/tests/Aetheria.Shared.Tests/FireControlCut4Tests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlCut4Tests.cs @@ -39,7 +39,7 @@ public sealed class FireControlCut4Tests : IDisposable private static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, FiringArc = 170, diff --git a/tests/Aetheria.Shared.Tests/FireControlCut5Tests.cs b/tests/Aetheria.Shared.Tests/FireControlCut5Tests.cs index f9d12e330..1727a9829 100644 --- a/tests/Aetheria.Shared.Tests/FireControlCut5Tests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlCut5Tests.cs @@ -37,7 +37,7 @@ public sealed class FireControlCut5Tests : IDisposable private static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/FireControlCut6Tests.cs b/tests/Aetheria.Shared.Tests/FireControlCut6Tests.cs index 1755cd7e3..03aab2e3f 100644 --- a/tests/Aetheria.Shared.Tests/FireControlCut6Tests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlCut6Tests.cs @@ -37,7 +37,7 @@ public sealed class FireControlCut6Tests : IDisposable private static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/FireControlCut6cTests.cs b/tests/Aetheria.Shared.Tests/FireControlCut6cTests.cs index e04ee078b..5517c4121 100644 --- a/tests/Aetheria.Shared.Tests/FireControlCut6cTests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlCut6cTests.cs @@ -36,7 +36,7 @@ public sealed class FireControlCut6cTests : IDisposable private static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/FireControlCut6dTests.cs b/tests/Aetheria.Shared.Tests/FireControlCut6dTests.cs index 828965836..9fdbde4a0 100644 --- a/tests/Aetheria.Shared.Tests/FireControlCut6dTests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlCut6dTests.cs @@ -38,7 +38,7 @@ public sealed class FireControlCut6dTests : IDisposable private static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/FireControlCut7Tests.cs b/tests/Aetheria.Shared.Tests/FireControlCut7Tests.cs index 01bd840ee..4e0c4a91f 100644 --- a/tests/Aetheria.Shared.Tests/FireControlCut7Tests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlCut7Tests.cs @@ -40,7 +40,7 @@ public sealed class FireControlCut7Tests : IDisposable private static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .9f, @@ -210,7 +210,7 @@ public sealed class FireControlCut7Tests : IDisposable var settings = new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; var log = new List(); diff --git a/tests/Aetheria.Shared.Tests/FireControlCut8Tests.cs b/tests/Aetheria.Shared.Tests/FireControlCut8Tests.cs index d5ce6a28b..a0d767ab3 100644 --- a/tests/Aetheria.Shared.Tests/FireControlCut8Tests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlCut8Tests.cs @@ -36,7 +36,7 @@ public sealed class FireControlCut8Tests : IDisposable private static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/FireControlCut9Tests.cs b/tests/Aetheria.Shared.Tests/FireControlCut9Tests.cs index cc63a9bc4..448cbb333 100644 --- a/tests/Aetheria.Shared.Tests/FireControlCut9Tests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlCut9Tests.cs @@ -39,7 +39,7 @@ public sealed class FireControlCut9Tests : IDisposable private static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/FireControlPerWeaponTests.cs b/tests/Aetheria.Shared.Tests/FireControlPerWeaponTests.cs index 21cde60cb..2eca55442 100644 --- a/tests/Aetheria.Shared.Tests/FireControlPerWeaponTests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlPerWeaponTests.cs @@ -39,7 +39,7 @@ public sealed class FireControlPerWeaponTests : IDisposable { OrbitalLayerHeight = orbitalLayerHeight, DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/FireControlTests.cs b/tests/Aetheria.Shared.Tests/FireControlTests.cs index 68ab9a6db..b10a2fa18 100644 --- a/tests/Aetheria.Shared.Tests/FireControlTests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlTests.cs @@ -33,7 +33,7 @@ public sealed class FireControlTests : IDisposable { ShipLayerHeight = shipLayerHeight, DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .5f, FiringArc = 120 diff --git a/tests/Aetheria.Shared.Tests/FlightTests.cs b/tests/Aetheria.Shared.Tests/FlightTests.cs index 263f9a086..cec6652c6 100644 --- a/tests/Aetheria.Shared.Tests/FlightTests.cs +++ b/tests/Aetheria.Shared.Tests/FlightTests.cs @@ -919,7 +919,7 @@ public sealed class FlightTests : IDisposable var slots = MessagePack.MessagePackSerializer.Deserialize(MessagePack.MessagePackSerializer.Serialize(faction, CultDocumentMessagePackSerialization.OptionsFor(typeof(Faction).Assembly))); - Assert.Equal(18, slots.Length); + Assert.Equal(21, slots.Length); Assert.Null(slots[16]); var doctrine = Assert.IsType(slots[17]); Assert.Equal(6f, Convert.ToSingle(doctrine[1])); diff --git a/tests/Aetheria.Shared.Tests/FloatingBodyTests.cs b/tests/Aetheria.Shared.Tests/FloatingBodyTests.cs index 3ca18c4aa..d2ee30870 100644 --- a/tests/Aetheria.Shared.Tests/FloatingBodyTests.cs +++ b/tests/Aetheria.Shared.Tests/FloatingBodyTests.cs @@ -36,7 +36,7 @@ public sealed class FloatingBodyTests : IDisposable var settings = new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; var items = new ItemManager(cache, new ProvenanceLedger(), settings, _ => { }); @@ -180,7 +180,7 @@ public sealed class FloatingBodyTests : IDisposable var settings = new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; var items = new ItemManager(cache, new ProvenanceLedger(), settings, _ => { }); diff --git a/tests/Aetheria.Shared.Tests/FlowFieldTests.cs b/tests/Aetheria.Shared.Tests/FlowFieldTests.cs index c5cb3b793..fefff55f4 100644 --- a/tests/Aetheria.Shared.Tests/FlowFieldTests.cs +++ b/tests/Aetheria.Shared.Tests/FlowFieldTests.cs @@ -25,7 +25,7 @@ public sealed class FlowFieldTests : IDisposable var settings = new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, FiringArc = 170, CommitHorizon = .5f, SchematicCellSize = 2f diff --git a/tests/Aetheria.Shared.Tests/GravitySubtractTests.cs b/tests/Aetheria.Shared.Tests/GravitySubtractTests.cs index 2b329ad5d..f21d78f79 100644 --- a/tests/Aetheria.Shared.Tests/GravitySubtractTests.cs +++ b/tests/Aetheria.Shared.Tests/GravitySubtractTests.cs @@ -24,7 +24,7 @@ public sealed class GravitySubtractTests : IDisposable var settings = new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, FiringArc = 170, CommitHorizon = .5f, SchematicCellSize = 2f diff --git a/tests/Aetheria.Shared.Tests/HeatResponseTests.cs b/tests/Aetheria.Shared.Tests/HeatResponseTests.cs index 0f21e50d1..9711f91c1 100644 --- a/tests/Aetheria.Shared.Tests/HeatResponseTests.cs +++ b/tests/Aetheria.Shared.Tests/HeatResponseTests.cs @@ -20,7 +20,7 @@ public sealed class HeatResponseTests : IDisposable private GameplaySettings Settings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tests/Aetheria.Shared.Tests/IffAndCombatTests.cs b/tests/Aetheria.Shared.Tests/IffAndCombatTests.cs index 0de789ff1..b2bd752ba 100644 --- a/tests/Aetheria.Shared.Tests/IffAndCombatTests.cs +++ b/tests/Aetheria.Shared.Tests/IffAndCombatTests.cs @@ -65,7 +65,7 @@ public sealed class IffAndCombatTests : IDisposable private static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .5f }; diff --git a/tests/Aetheria.Shared.Tests/InputCapacitorTests.cs b/tests/Aetheria.Shared.Tests/InputCapacitorTests.cs index 3a7b9e2d5..d7279380e 100644 --- a/tests/Aetheria.Shared.Tests/InputCapacitorTests.cs +++ b/tests/Aetheria.Shared.Tests/InputCapacitorTests.cs @@ -24,7 +24,7 @@ public sealed class InputCapacitorTests : IDisposable private static GameplaySettings Settings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tests/Aetheria.Shared.Tests/InspectionScannerCatalogTests.cs b/tests/Aetheria.Shared.Tests/InspectionScannerCatalogTests.cs index 43d7fcce4..e9cb862fa 100644 --- a/tests/Aetheria.Shared.Tests/InspectionScannerCatalogTests.cs +++ b/tests/Aetheria.Shared.Tests/InspectionScannerCatalogTests.cs @@ -102,7 +102,7 @@ public sealed class InspectionScannerCatalogTests ledger.Lots[1] = new Lot { Origin = new Attributed(), Quality = .5f }; ledger.Lots[2] = new Lot { - Origin = new Attributed(), Quality = .5f, + Origin = new Attributed(), Quality = 1f, Roles = product.Roles.Select(r => new RoleFill { Role = r.Role, Quality = r.Mean }).ToList(), }; var items = new ItemManager(Cache, ledger, settings, _ => { }); diff --git a/tests/Aetheria.Shared.Tests/LaunchSuppressorCatalogTests.cs b/tests/Aetheria.Shared.Tests/LaunchSuppressorCatalogTests.cs index 096845380..d54f7c983 100644 --- a/tests/Aetheria.Shared.Tests/LaunchSuppressorCatalogTests.cs +++ b/tests/Aetheria.Shared.Tests/LaunchSuppressorCatalogTests.cs @@ -113,7 +113,7 @@ public sealed class LaunchSuppressorCatalogTests for (var i = 1; i <= suppressorLot; i++) ledger.Lots[i] = new Lot { Origin = new Attributed(), Quality = .5f }; ledger.Lots[suppressorLot] = new Lot { - Origin = new Attributed(), Quality = .5f, + Origin = new Attributed(), Quality = 1f, Roles = new List { new RoleFill { Role = "baffles", Quality = baffles }, new RoleFill { Role = "heat sink", Quality = sink } }, }; var items = new ItemManager(Cache, ledger, settings, _ => { }); diff --git a/tests/Aetheria.Shared.Tests/LayerTests.cs b/tests/Aetheria.Shared.Tests/LayerTests.cs index cb1bf4cf9..75d79d947 100644 --- a/tests/Aetheria.Shared.Tests/LayerTests.cs +++ b/tests/Aetheria.Shared.Tests/LayerTests.cs @@ -37,7 +37,7 @@ public sealed class LayerTests : IDisposable private static GameplaySettings Settings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), ShipLayerHeight = ShipHeight, OrbitalLayerHeight = OrbitalHeight, FloaterLayerHeight = FloaterHeight }; diff --git a/tests/Aetheria.Shared.Tests/LoadoutTests.cs b/tests/Aetheria.Shared.Tests/LoadoutTests.cs index f1ae47b5d..4efbd0b30 100644 --- a/tests/Aetheria.Shared.Tests/LoadoutTests.cs +++ b/tests/Aetheria.Shared.Tests/LoadoutTests.cs @@ -489,8 +489,8 @@ public sealed class LoadoutTests : IDisposable Assert.Equal(hardpointItems[0].item.Lot, hardpointItems[1].item.Lot); } - // A Lamp lot with Quality .2 and one role fill (lens .9): a stat reading that role gets .9, one reading none - // gets .2, and GetTier reads .2. + // A Lamp lot with Quality .2 and one role fill (lens .15, under the assembly): a stat reading that role gets .15, one + // reading none gets .2, and GetTier reads .2. [Fact] public void StatsReadTheLot() { @@ -500,8 +500,8 @@ public sealed class LoadoutTests : IDisposable // quality", since every lot would resolve to the only tier regardless of its own Quality. settings.Tiers = new[] { - new RarityTier { Name = "Common", Quality = .2f, Rarity = 0, Color = new float3(1, 1, 1) }, - new RarityTier { Name = "Rare", Quality = .5f, Rarity = 1, Color = new float3(1, 1, 1) } + new RarityTier { Name = "Common", Quality = .2f, Color = new float3(1, 1, 1) }, + new RarityTier { Name = "Rare", Quality = .5f, Color = new float3(1, 1, 1) } }; var items = new ItemManager(cache, new ProvenanceLedger(), settings, _ => { }); var lamp = cache.GetByName("Lamp"); @@ -510,7 +510,7 @@ public sealed class LoadoutTests : IDisposable Design = cache.RefOf(lamp), Origin = new Attributed(), Quality = .2f, - Roles = new List { new RoleFill { Role = "lens", Quality = .9f } } + Roles = new List { new RoleFill { Role = "lens", Quality = .15f } } }); var rareLot = items.Lots.Add(new Lot { @@ -524,7 +524,7 @@ public sealed class LoadoutTests : IDisposable var withRole = new PerformanceStat { Min = 0, Max = 1, Terms = { new StatTerm { Source = StatSource.Quality, Exponent = 1, Role = "lens" } } }; var noRole = new PerformanceStat { Min = 0, Max = 1, Terms = { new StatTerm { Source = StatSource.Quality, Exponent = 1 } } }; - Assert.Equal(.9f, items.Evaluate(withRole, instance), 3); + Assert.Equal(.15f, items.Evaluate(withRole, instance), 3); Assert.Equal(.2f, items.Evaluate(noRole, instance), 3); Assert.Equal(.2f, items.GetTier(instance).tier.Quality, 3); Assert.Equal(.5f, items.GetTier(rareInstance).tier.Quality, 3); diff --git a/tests/Aetheria.Shared.Tests/LockWarningTests.cs b/tests/Aetheria.Shared.Tests/LockWarningTests.cs index 18b068e63..1ed414bb6 100644 --- a/tests/Aetheria.Shared.Tests/LockWarningTests.cs +++ b/tests/Aetheria.Shared.Tests/LockWarningTests.cs @@ -43,7 +43,7 @@ public sealed class LockWarningTests : IDisposable _items = new ItemManager(_openCache, ledger, new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/LootTests.cs b/tests/Aetheria.Shared.Tests/LootTests.cs index 4aef9ff25..f0b52f4ce 100644 --- a/tests/Aetheria.Shared.Tests/LootTests.cs +++ b/tests/Aetheria.Shared.Tests/LootTests.cs @@ -66,7 +66,7 @@ public sealed class LootTests : IDisposable var settings = new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, FiringArc = 170, CommitHorizon = .5f, SchematicCellSize = 1f, diff --git a/tests/Aetheria.Shared.Tests/MineTests.cs b/tests/Aetheria.Shared.Tests/MineTests.cs index ddb805206..a2deeb5cf 100644 --- a/tests/Aetheria.Shared.Tests/MineTests.cs +++ b/tests/Aetheria.Shared.Tests/MineTests.cs @@ -72,7 +72,7 @@ public sealed class MineTests : IDisposable var settings = new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, FiringArc = 170, CommitHorizon = .5f, SchematicCellSize = 2f, diff --git a/tests/Aetheria.Shared.Tests/MiningCut1Tests.cs b/tests/Aetheria.Shared.Tests/MiningCut1Tests.cs index c3700bd81..aa00d690e 100644 --- a/tests/Aetheria.Shared.Tests/MiningCut1Tests.cs +++ b/tests/Aetheria.Shared.Tests/MiningCut1Tests.cs @@ -27,7 +27,7 @@ public sealed class MiningCut1Tests : IDisposable private static GameplaySettings GameSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tests/Aetheria.Shared.Tests/MiningCut2Tests.cs b/tests/Aetheria.Shared.Tests/MiningCut2Tests.cs index c05fc1f32..b484eed9f 100644 --- a/tests/Aetheria.Shared.Tests/MiningCut2Tests.cs +++ b/tests/Aetheria.Shared.Tests/MiningCut2Tests.cs @@ -31,7 +31,7 @@ public sealed class MiningCut2Tests : IDisposable private static GameplaySettings GameSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tests/Aetheria.Shared.Tests/MiningCut3Tests.cs b/tests/Aetheria.Shared.Tests/MiningCut3Tests.cs index e77d6c89b..e0eefce59 100644 --- a/tests/Aetheria.Shared.Tests/MiningCut3Tests.cs +++ b/tests/Aetheria.Shared.Tests/MiningCut3Tests.cs @@ -37,7 +37,7 @@ public sealed partial class MiningCut3Tests : IDisposable private static GameplaySettings GameSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), // Settings.asset's own values for the three detection tunables. VisibilityDecay = .5f, diff --git a/tests/Aetheria.Shared.Tests/PaintModeTests.cs b/tests/Aetheria.Shared.Tests/PaintModeTests.cs index 44af2dae0..02fcf71e1 100644 --- a/tests/Aetheria.Shared.Tests/PaintModeTests.cs +++ b/tests/Aetheria.Shared.Tests/PaintModeTests.cs @@ -63,7 +63,7 @@ public sealed class PaintModeTests : IDisposable _items = new ItemManager(_openCache, ledger, new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/PickupTests.cs b/tests/Aetheria.Shared.Tests/PickupTests.cs index af979eea5..316c8b7b8 100644 --- a/tests/Aetheria.Shared.Tests/PickupTests.cs +++ b/tests/Aetheria.Shared.Tests/PickupTests.cs @@ -71,7 +71,7 @@ public sealed class PickupTests : IDisposable var settings = new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, FiringArc = 170, CommitHorizon = .5f, SchematicCellSize = 1f, diff --git a/tests/Aetheria.Shared.Tests/PopulatedRadiusTests.cs b/tests/Aetheria.Shared.Tests/PopulatedRadiusTests.cs index 20d6793a0..a106b217e 100644 --- a/tests/Aetheria.Shared.Tests/PopulatedRadiusTests.cs +++ b/tests/Aetheria.Shared.Tests/PopulatedRadiusTests.cs @@ -64,7 +64,7 @@ public sealed class PopulatedRadiusTests : IDisposable var items = new ItemManager(cache, new ProvenanceLedger(), new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }, _ => { }); diff --git a/tests/Aetheria.Shared.Tests/PotentialOwnerTests.cs b/tests/Aetheria.Shared.Tests/PotentialOwnerTests.cs index 6805bc82e..94100844a 100644 --- a/tests/Aetheria.Shared.Tests/PotentialOwnerTests.cs +++ b/tests/Aetheria.Shared.Tests/PotentialOwnerTests.cs @@ -28,7 +28,7 @@ public sealed class PotentialOwnerTests : IDisposable var settings = new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; _items = new ItemManager(_cache, new ProvenanceLedger(), settings, _ => { }); diff --git a/tests/Aetheria.Shared.Tests/PowerBusTests.cs b/tests/Aetheria.Shared.Tests/PowerBusTests.cs index 2ab76f599..f4277b6fd 100644 --- a/tests/Aetheria.Shared.Tests/PowerBusTests.cs +++ b/tests/Aetheria.Shared.Tests/PowerBusTests.cs @@ -27,7 +27,7 @@ public sealed class PowerBusTests : IDisposable private static GameplaySettings Settings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tests/Aetheria.Shared.Tests/PowerCurveTests.cs b/tests/Aetheria.Shared.Tests/PowerCurveTests.cs index 4a747dcaf..38db0eec6 100644 --- a/tests/Aetheria.Shared.Tests/PowerCurveTests.cs +++ b/tests/Aetheria.Shared.Tests/PowerCurveTests.cs @@ -36,7 +36,7 @@ public sealed class PowerCurveTests : IDisposable private static GameplaySettings Settings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tests/Aetheria.Shared.Tests/PowerTierTests.cs b/tests/Aetheria.Shared.Tests/PowerTierTests.cs index ecdbd4b2d..fc947ffb1 100644 --- a/tests/Aetheria.Shared.Tests/PowerTierTests.cs +++ b/tests/Aetheria.Shared.Tests/PowerTierTests.cs @@ -27,7 +27,7 @@ public sealed class PowerTierTests : IDisposable private static GameplaySettings Settings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tests/Aetheria.Shared.Tests/RoleAuthoringTests.cs b/tests/Aetheria.Shared.Tests/RoleAuthoringTests.cs index 0a17e2732..091e74c3b 100644 --- a/tests/Aetheria.Shared.Tests/RoleAuthoringTests.cs +++ b/tests/Aetheria.Shared.Tests/RoleAuthoringTests.cs @@ -20,7 +20,7 @@ public sealed class RoleAuthoringTests : IDisposable private GameplaySettings Settings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; @@ -84,7 +84,7 @@ public sealed class RoleAuthoringTests : IDisposable public void TwoProductsOfOneDesignWithDifferentRoleMeansResolveDifferentValues() { using var cache = AetheriaStores.Open(Catalog, catalogWritable: true); - var makerRef = cache.Upsert(new Faction { Name = "Maker", ShortName = "MKR" }); + var makerRef = cache.Upsert(new Faction { Name = "Maker", ShortName = "MKR", AssemblyMean = 1f, AssemblyDeviation = 0 }); var lensGear = cache.Upsert(new GearData { Name = "Lensed", Hardpoint = HardpointType.Sensors, Shape = new Shape(), Price = 10, diff --git a/tests/Aetheria.Shared.Tests/RunSaveTests.cs b/tests/Aetheria.Shared.Tests/RunSaveTests.cs index d4196b0cb..3bd075724 100644 --- a/tests/Aetheria.Shared.Tests/RunSaveTests.cs +++ b/tests/Aetheria.Shared.Tests/RunSaveTests.cs @@ -693,7 +693,7 @@ public sealed class RunSaveTests : IDisposable internal static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tests/Aetheria.Shared.Tests/ShieldReserveTests.cs b/tests/Aetheria.Shared.Tests/ShieldReserveTests.cs index d84519034..3bd741e57 100644 --- a/tests/Aetheria.Shared.Tests/ShieldReserveTests.cs +++ b/tests/Aetheria.Shared.Tests/ShieldReserveTests.cs @@ -32,7 +32,7 @@ public sealed class ShieldReserveTests : IDisposable private static GameplaySettings Settings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tests/Aetheria.Shared.Tests/SignatureTests.cs b/tests/Aetheria.Shared.Tests/SignatureTests.cs index f1289f58a..8468ac8dd 100644 --- a/tests/Aetheria.Shared.Tests/SignatureTests.cs +++ b/tests/Aetheria.Shared.Tests/SignatureTests.cs @@ -45,7 +45,7 @@ public sealed class SignatureTests : IDisposable private GameplaySettings Settings(float visibilityDecay) => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = .1f, TargetGearInfoThreshold = .8f, diff --git a/tests/Aetheria.Shared.Tests/StatResolverTests.cs b/tests/Aetheria.Shared.Tests/StatResolverTests.cs index aefb239c1..4469eb333 100644 --- a/tests/Aetheria.Shared.Tests/StatResolverTests.cs +++ b/tests/Aetheria.Shared.Tests/StatResolverTests.cs @@ -26,7 +26,7 @@ public sealed class StatResolverTests : IDisposable private static GameplaySettings Settings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tests/Aetheria.Shared.Tests/TargetingSystemTests.cs b/tests/Aetheria.Shared.Tests/TargetingSystemTests.cs index 15fa14568..cd43cd789 100644 --- a/tests/Aetheria.Shared.Tests/TargetingSystemTests.cs +++ b/tests/Aetheria.Shared.Tests/TargetingSystemTests.cs @@ -34,7 +34,7 @@ public sealed class TargetingSystemTests : IDisposable private static GameplaySettings TestSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetGearInfoThreshold = .9f, UnaidedAccuracy = .1f, diff --git a/tests/Aetheria.Shared.Tests/ThrottleLockTests.cs b/tests/Aetheria.Shared.Tests/ThrottleLockTests.cs index 8511e371a..ca0f76a97 100644 --- a/tests/Aetheria.Shared.Tests/ThrottleLockTests.cs +++ b/tests/Aetheria.Shared.Tests/ThrottleLockTests.cs @@ -24,7 +24,7 @@ public sealed class ThrottleLockTests : IDisposable private static GameplaySettings Settings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TorqueMultiplier = 1f }; diff --git a/tests/Aetheria.Shared.Tests/VapourCloudTests.cs b/tests/Aetheria.Shared.Tests/VapourCloudTests.cs index 4b55ee97e..e4d57a1cf 100644 --- a/tests/Aetheria.Shared.Tests/VapourCloudTests.cs +++ b/tests/Aetheria.Shared.Tests/VapourCloudTests.cs @@ -61,7 +61,7 @@ public sealed class VapourCloudTests : IDisposable var settings = new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp(), TargetDetectionInfoThreshold = Threshold, TargetGearInfoThreshold = .8f, TargetInfoDecay = .5f, VisibilityDecay = 0f, diff --git a/tests/Aetheria.Shared.Tests/ZonePlacedAtBuildTests.cs b/tests/Aetheria.Shared.Tests/ZonePlacedAtBuildTests.cs index f02992ff5..dada889f0 100644 --- a/tests/Aetheria.Shared.Tests/ZonePlacedAtBuildTests.cs +++ b/tests/Aetheria.Shared.Tests/ZonePlacedAtBuildTests.cs @@ -32,7 +32,7 @@ public sealed class ZonePlacedAtBuildTests : IDisposable private static GameplaySettings GameSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tests/Aetheria.Shared.Tests/ZoneWorlds.cs b/tests/Aetheria.Shared.Tests/ZoneWorlds.cs index d1eec2091..f2dd4ba72 100644 --- a/tests/Aetheria.Shared.Tests/ZoneWorlds.cs +++ b/tests/Aetheria.Shared.Tests/ZoneWorlds.cs @@ -27,7 +27,7 @@ internal sealed class ZoneWorlds : IDisposable private static GameplaySettings GameSettings() => new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() }; diff --git a/tools/AetherDb/AssemblyFromMakerCommand.cs b/tools/AetherDb/AssemblyFromMakerCommand.cs new file mode 100644 index 000000000..d1f354bde --- /dev/null +++ b/tools/AetherDb/AssemblyFromMakerCommand.cs @@ -0,0 +1,70 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using GameCult.Caching; + +// assembly-from-maker [apply] (aetheria-release, cut assembly-from-maker; rulings quality-is-assembly-over-supply-chain, +// quality-lean-assembly-hard-ceiling): derives each maker's final-assembly distribution from the products it sells. A faction +// that manufactures at least one product with roles gets AssemblyMean = the mean of those products' role means and +// AssemblyDeviation = the mean of their standard deviations, rounded to 2 dp; every other faction gets the field defaults. +// The derivation reads the products, so it replays last, after every command that adds products or factions. A faction that +// already holds the derived values is not rewritten, so a rerun writes nothing. Dry run unless apply. +public static class AssemblyFromMakerCommand +{ + // The distribution a maker's roled products imply: the mean over every role of every product, so a product with more + // roles weighs more. Null when there is no role to average. + public static (float Mean, float Deviation)? Derive(IEnumerable products) + { + var roles = products.SelectMany(p => p.Roles ?? new List()).ToArray(); + if (roles.Length == 0) return null; + return ((float) Math.Round(roles.Average(r => r.Mean), 2), (float) Math.Round(roles.Average(r => r.StandardDeviation), 2)); + } + + public static int Run(CultCache cache, bool apply, TextWriter output) + { + var defaults = new Faction(); + var byMaker = cache.GetAll() + .GroupBy(p => p.Manufacturer.Key) + .Select(g => (Maker: g.Key, Derived: Derive(g))) + .Where(m => m.Derived != null) + .ToDictionary(m => m.Maker, m => m.Derived.Value); + + var changed = new List(); + foreach (var faction in cache.GetAll().OrderBy(f => f.Name, StringComparer.Ordinal)) + { + var (mean, deviation) = byMaker.TryGetValue(cache.RefOf(faction).Key, out var derived) + ? derived + : (defaults.AssemblyMean, defaults.AssemblyDeviation); + if (faction.AssemblyMean == mean && faction.AssemblyDeviation == deviation) continue; + output.WriteLine($"{faction.Name}: assembly {faction.AssemblyMean:0.##}±{faction.AssemblyDeviation:0.##} -> {mean:0.##}±{deviation:0.##}"); + faction.AssemblyMean = mean; + faction.AssemblyDeviation = deviation; + changed.Add(faction); + } + + if (changed.Count == 0) + { + output.WriteLine("No changes."); + return 0; + } + + if (!apply) + { + output.WriteLine($"\nDry run. Pass \"apply\" to write {changed.Count} factions."); + return 0; + } + + foreach (var faction in changed) CultRecordRefs.Validate(faction); + cache.Commit(batch => + { + foreach (var faction in changed) batch.Upsert(typeof(Faction), faction, cache.RefOf(faction).Key); + }); + output.WriteLine($"\nWrote {changed.Count} factions in Aetheria.cc"); + return 0; + } +} diff --git a/tools/AetherDb/Program.cs b/tools/AetherDb/Program.cs index 9d4fe5251..79a6d68fa 100644 --- a/tools/AetherDb/Program.cs +++ b/tools/AetherDb/Program.cs @@ -57,9 +57,10 @@ public static class Program case "inspection-scanner": return InspectionScannerCatalog(args.Contains("apply")); case "product-lines": return ProductLinesCommand.Run(args.Skip(1).ToArray()); case "minor-power-factions": return MinorPowerFactionsCommand.Run(args.Skip(1).ToArray()); + case "assembly-from-maker": return AssemblyFromMakerCommand.Run(AetherDb.Open(catalogWritable: args.Contains("apply")).Cache, args.Contains("apply"), Console.Out); case "doctrine-catalog": return DoctrineCatalog.Run(AetherDb.Open(catalogWritable: args.Contains("apply")).Cache, args.Contains("apply"), Console.Out); default: - Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear ]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], range-falloff [apply] [--effective ] [--end ], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], ship-authoring create|inspect|validate|compose, field-kinds [apply], mine-launcher [apply], smoke-hull [apply], smoke-rounds [apply], roles-backfill [apply], pd-gear [apply], consumables-first-set [apply], launch-suppressor [apply], pirates-faction [apply], verse-grammar [apply], generic-designs [apply], sensor-stat-set [apply], inspection-scanner [apply], minor-power-factions [apply], product-lines weapons|minor-powers|gear [apply], doctrine-catalog [apply]"); + Console.WriteLine("commands: census, factions, station-fit, hardpoint-fit, loadout [seed], save, settings, settings-dump, dangling [clear ]... [apply], shield-migrate [apply], brownout-migrate [apply], roles-migrate [apply], firing-arc-migrate [apply], range-falloff [apply] [--effective ] [--end ], targeting-catalog [apply], targeting-catalog-6c [apply], targeting-catalog-6d [apply], ship-authoring create|inspect|validate|compose, field-kinds [apply], mine-launcher [apply], smoke-hull [apply], smoke-rounds [apply], roles-backfill [apply], pd-gear [apply], consumables-first-set [apply], launch-suppressor [apply], pirates-faction [apply], verse-grammar [apply], generic-designs [apply], sensor-stat-set [apply], inspection-scanner [apply], minor-power-factions [apply], product-lines weapons|minor-powers|gear [apply], doctrine-catalog [apply], assembly-from-maker [apply]"); return 1; } } @@ -557,7 +558,7 @@ public static class Program Console.WriteLine($" zone radius curve {zones.ZoneRadius?.Minimum}-{zones.ZoneRadius?.Maximum} exponent {zones.ZoneRadius?.Exponent}"); Console.WriteLine($" sub zone count {zones.SubZoneCount?.Minimum}-{zones.SubZoneCount?.Maximum} exponent {zones.SubZoneCount?.Exponent}"); Console.WriteLine($"gameplay: weapon groups {gameplay.WeaponGroupCount}, shutdown performance {gameplay.DefaultEntitySettings?.ShutdownPerformance}"); - Console.WriteLine($" tiers: {string.Join(", ", (gameplay.Tiers ?? new RarityTier[0]).Select(t => $"{t.Name} q{t.Quality} r{t.Rarity}"))}"); + Console.WriteLine($" tiers: {string.Join(", ", (gameplay.Tiers ?? new RarityTier[0]).Select(t => $"{t.Name} q{t.Quality}"))}"); Console.WriteLine($" price modifier {gameplay.QualityPriceModifier?.Minimum}-{gameplay.QualityPriceModifier?.Maximum} exponent {gameplay.QualityPriceModifier?.Exponent}"); // Assert counts, not non-null: an empty array reads as populated and would make every number a fixture @@ -792,7 +793,7 @@ public static class Program var settings = new GameplaySettings { DefaultEntitySettings = new EntitySettings(), - Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } }, + Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Color = new float3(1, 1, 1) } }, QualityPriceModifier = new ExponentialLerp() };