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:
@@ -1,4 +1,5 @@
|
||||
using HSchool.Content;
|
||||
using HSchool.People;
|
||||
|
||||
namespace HSchool.Ai.Tests;
|
||||
|
||||
@@ -97,6 +98,40 @@ public class LessonLearningTests
|
||||
|
||||
Assert.Equal(explicitWarm, implied);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MissingTextbook_HalvesGain()
|
||||
{
|
||||
var withBook = LessonLearning.Gain(50, Math, 1, 0.05f, 1f, 1f, 0, 100, warmth: 1f, textbookFactor: 1f);
|
||||
var without = LessonLearning.Gain(50, Math, 1, 0.05f, 1f, 1f, 0, 100, warmth: 1f, textbookFactor: 0.5f);
|
||||
|
||||
Assert.Equal((withBook - 50) * 0.5f, without - 50, precision: 5);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TextbookInBag_OnlyThatSubjectCounts()
|
||||
{
|
||||
var items = new[]
|
||||
{
|
||||
new InventoryItem("Textbook", null, 1f, ItemLocations.Bag, "Literature"),
|
||||
new InventoryItem("Textbook", null, 1f, ItemLocations.Locker, "Mathematics"),
|
||||
};
|
||||
|
||||
Assert.False(LessonLearning.HasTextbookInBag(items, "Mathematics"));
|
||||
Assert.True(LessonLearning.HasTextbookInBag(items, "Literature"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TextbookAtHome_DoesNotCount()
|
||||
{
|
||||
var items = new[]
|
||||
{
|
||||
new InventoryItem("Textbook", null, 1f, ItemLocations.Home, "Mathematics"),
|
||||
};
|
||||
|
||||
Assert.False(LessonLearning.HasTextbookInBag(items, "Mathematics"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MissingTeacherSkill_UsesRangeMin_AndStillGains()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user