Assembly is the maker's: lot quality drawn from Faction.AssemblyMean/Deviation, roles read min(part, assembly)

Deletes ItemManager.RollQuality and RarityTier.Rarity. Faction keys 19 and 20
(18 is reserved for Livery). AetherDb assembly-from-maker derives the fields.
Builds AetherDb on the CultLib 45c2f400 / CultMath 9c1b06cd pins; Shared.Tests
not yet run; the shipped-catalog test fails until the catalog commit follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-17 06:20:01 +02:00
commit c5905c3b7f
60 changed files with 367 additions and 84 deletions

View file

@ -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]

View file

@ -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<ItemData>(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<RoleFill>()
};
if (design.Roles != null)

View file

@ -72,18 +72,20 @@ public class Lot
// (console give, presets, extracted), which brand their maker only.
[Key(4)] public CultRecordRef<FactionProductData> 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
{

View file

@ -307,5 +307,4 @@ public class RarityTier
public string Name;
public float Quality;
public float3 Color;
public float Rarity;
}