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:
@@ -134,6 +134,53 @@ public class WhisperTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CaughtWhisper_BecomesDisciplineTalkWithTeacher()
|
||||
{
|
||||
var (school, homeroom, firstId, secondId, teacherId) = TwoPupilsAndTeacher();
|
||||
using (school)
|
||||
{
|
||||
AdvanceTo(school, LessonStart);
|
||||
var converted = false;
|
||||
for (var i = 0; i < 24; i++)
|
||||
{
|
||||
school.Clock.JumpTo(LessonStart.AddMinutes(i));
|
||||
TalkCircleSystem.Interrupt(school, firstId);
|
||||
TalkCircleSystem.Interrupt(school, secondId);
|
||||
TalkCircleSystem.Interrupt(school, teacherId);
|
||||
var schoolClass = school.Roster!.Classes.First(row => row.PupilIds.Contains(firstId));
|
||||
foreach (var id in schoolClass.PupilIds)
|
||||
{
|
||||
PlaceAt(school, id, id == firstId || id == secondId ? homeroom : "corridor-1");
|
||||
}
|
||||
|
||||
PlaceAt(school, firstId, homeroom);
|
||||
PlaceAt(school, secondId, homeroom);
|
||||
PlaceAt(school, teacherId, homeroom);
|
||||
Assert.True(school.TryStartAction(firstId, TalkActions.Whisper));
|
||||
TalkCircleSystem.Apply(school, 0.2d);
|
||||
if (!school.DayLog.Any(row =>
|
||||
(row.PersonId == firstId || row.PersonId == secondId)
|
||||
&& row.Type.Equals(PersonLogTypes.TeacherInterrupted, StringComparison.Ordinal)
|
||||
&& row.Time == school.Clock.Time))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Assert.Equal(TalkActions.TeacherTalk, ActivityOf(school, firstId));
|
||||
Assert.Equal(TalkActions.TeacherTalk, ActivityOf(school, teacherId));
|
||||
var circle = school.TalkCircleOf(firstId);
|
||||
Assert.NotNull(circle);
|
||||
Assert.Equal(TeacherTopics.Discipline, circle.TopicId);
|
||||
Assert.Contains(teacherId, circle.MemberIds);
|
||||
converted = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Assert.True(converted);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OrdinaryChat_DoesNotStartOnLesson()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user