Sum warmth insulation from worn items and refresh goldens for the new trait pool.

HeatLoving and ColdLoving shift later trait rolls; worn clothes now feed PersonInsulation instead of reflection.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-20 04:00:53 +03:00
co-authored by Cursor
parent 34acec16c2
commit 53c4ae0f92
7 changed files with 389 additions and 289 deletions
+9 -34
View File
@@ -34,40 +34,15 @@ public readonly record struct PersonInsulation(float Value)
return Naked;
}
var worn = WornDefs(person);
var worn = new List<string>();
foreach (var item in person.Items)
{
if (item.Location.Equals(ItemLocations.Worn, StringComparison.Ordinal))
{
worn.Add(item.Def);
}
}
return worn.Count == 0 ? Naked : FromWorn(catalog, [.. worn]);
}
private static List<string> WornDefs(Person person)
{
var worn = new List<string>();
if (person.GetType().GetProperty("Items")?.GetValue(person) is not System.Collections.IEnumerable items)
{
return worn;
}
foreach (var item in items)
{
if (item is null)
{
continue;
}
var type = item.GetType();
var def = type.GetProperty("Def")?.GetValue(item) as string;
var location = type.GetProperty("Location")?.GetValue(item) as string
?? type.GetProperty("Place")?.GetValue(item) as string;
if (def is null || location is null)
{
continue;
}
if (location.Equals("worn", StringComparison.OrdinalIgnoreCase))
{
worn.Add(def);
}
}
return worn;
}
}