Author manufacturer variation as faction products
A design lists role names; a faction product is a manufacturer's branded build of one, carrying its name, its flavor text, and a pseudo-gaussian quality distribution per role whose mean is the technology put in and whose deviation is their quality control. A PerformanceStat may name the role whose quality it reads, unset reading the item own workmanship as before, so old saves behave unchanged. Generation selects products rather than designs, which makes what a faction makes the availability rule. This is Njordr shape at one dimension: role names, per-role derivation and per-product distributions carry over when quality widens into dimensions. No parts exist yet; the product authors the role quality. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
95932da895
commit
8d93b937bc
11 changed files with 275 additions and 95 deletions
|
|
@ -99,7 +99,7 @@ public class ItemManager
|
|||
public float Evaluate(PerformanceStat stat, EquippableItem item)
|
||||
{
|
||||
var data = GetData(item);
|
||||
var quality = pow(item.Quality, stat.QualityExponent);
|
||||
var quality = pow(item.QualityForRole(stat.FromRole), stat.QualityExponent);
|
||||
var durabilityExponent = lerp(
|
||||
GameplaySettings.DurabilityQualityMin,
|
||||
GameplaySettings.DurabilityQualityMax,
|
||||
|
|
@ -190,6 +190,33 @@ public class ItemManager
|
|||
return CreateInstance(item, 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.
|
||||
public CraftedItemInstance CreateInstance(FactionProductData product)
|
||||
{
|
||||
var design = ItemData.Get<CraftedItemData>(product.Design);
|
||||
if (design == null)
|
||||
{
|
||||
_logger($"Product {product.Name} names a design that does not exist!");
|
||||
return null;
|
||||
}
|
||||
|
||||
var instance = CreateInstance(design);
|
||||
instance.Product = product.ID;
|
||||
if (design.Roles == null) return instance;
|
||||
foreach (var role in design.Roles)
|
||||
{
|
||||
var build = product.Roles?.FirstOrDefault(b => b.Role == role.Name) ?? new ProductRole();
|
||||
instance.Ingredients.Add(new RoleFill
|
||||
{
|
||||
Role = role.Name,
|
||||
Quality = clamp(Random.NextGaussian(build.Mean, build.StandardDeviation), .01f, 1)
|
||||
});
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public (RarityTier tier, int upgrades) GetTier(CraftedItemInstance item)
|
||||
{
|
||||
var tier = GameplaySettings.Tiers[0];
|
||||
|
|
|
|||
Loading…
Reference in a new issue