Halve lesson gain when the bag has no textbook for the subject.
Locker and home do not count. A pack without the field keeps vanilla 0.5. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -64,6 +64,39 @@ public class BehaviorDefTests
|
||||
Assert.Contains("carry mass", error.Message, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MissingLessonNoTextbookFactor_DefaultsToHalf()
|
||||
{
|
||||
var catalog = _loader.Load(
|
||||
[CatalogLoader.CorePackId],
|
||||
[
|
||||
PackDocuments.Def(
|
||||
CatalogLoader.CorePackId,
|
||||
"behavior",
|
||||
"rules",
|
||||
"""{ "defName": "Behavior", "needThreshold": 0.35, "lessonSkillPerHour": 0.05, "commuteSlackMin": 0, "commuteSlackMax": 6, "switchMargin": 0.15 }"""),
|
||||
]);
|
||||
|
||||
Assert.NotNull(catalog.BehaviorRules);
|
||||
Assert.Equal(0.5f, catalog.BehaviorRules.LessonNoTextbookFactor);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LessonNoTextbookFactor_OutOfRange_FailsTheCatalog()
|
||||
{
|
||||
var error = Assert.Throws<ContentLoadException>(() => _loader.Load(
|
||||
[CatalogLoader.CorePackId],
|
||||
[
|
||||
PackDocuments.Def(
|
||||
CatalogLoader.CorePackId,
|
||||
"behavior",
|
||||
"rules",
|
||||
"""{ "defName": "Behavior", "lessonNoTextbookFactor": 1.5 }"""),
|
||||
]));
|
||||
|
||||
Assert.Contains("lessonNoTextbookFactor", error.Message, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NegativeApparelWear_FailsTheCatalog()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user