FieldKinds.Assign: a kind needs a positive kind weight and a positive province factor; two negatives no longer draw

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-10-27 09:59:15 +01:00
commit 4b7e5476c0
2 changed files with 22 additions and 2 deletions

View file

@ -226,8 +226,9 @@ public static class FieldKinds
.Select(kind =>
{
var key = catalog.RefOf(kind).Key;
return (Key: key, Weight: kind.GenerationWeight * Factor(
type?.Kinds.Where(entry => entry.Kind.Key.Equals(key)).Select(entry => (double) entry.Weight), 1.0));
var factor = Factor(type?.Kinds.Where(entry => entry.Kind.Key.Equals(key)).Select(entry => (double) entry.Weight), 1.0);
// Both must be positive: two negatives do not multiply into a weight.
return (Key: key, Weight: kind.GenerationWeight > 0f && factor > 0.0 ? kind.GenerationWeight * factor : 0.0);
})
.Where(kind => kind.Weight > 0.0)
.OrderBy(kind => kind.Key.Value, StringComparer.Ordinal)