Persist talk opinions and pick topics by weight.
A finished circle never set Tick's peopleChanged bit, so people.json kept pre-talk numbers until morning drift. PickTopic compared a 0..total roll to a 0..1 cursor, so gossip almost never changed the subject. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -63,6 +63,22 @@ public class MorningOpinionsTests
|
||||
Assert.True(after < before);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DriftToZero_DropsTheRecord()
|
||||
{
|
||||
using var school = OpenStaffed();
|
||||
var child = school.Roster!.People.First(person => person.IsStudent && !person.IsParent);
|
||||
var classmate = school.Roster.People.First(person =>
|
||||
person.IsStudent
|
||||
&& !person.Id.Equals(child.Id, StringComparison.Ordinal)
|
||||
&& !OpinionStore.FamilyMemberIds(school.Roster, child).Contains(person.Id));
|
||||
var drift = school.Catalog!.BehaviorRules!.OpinionDriftPerMorning;
|
||||
OpinionStore.Set(child, classmate.Id, Math.Min(2, drift));
|
||||
|
||||
Assert.True(MorningOpinions.Apply(school));
|
||||
Assert.False(child.Opinions.ContainsKey(classmate.Id));
|
||||
}
|
||||
|
||||
private static void AdvanceTo(School school, DateTime until)
|
||||
{
|
||||
while (school.Clock.Time < until)
|
||||
|
||||
Reference in New Issue
Block a user