mirror of
https://github.com/rr-/pq-cli.git
synced 2026-11-12 22:40:36 -07:00
mechanic: keep at most 100 quests in the log
This commit is contained in:
2 files changed
+9
-1
No files matched your search
+1
-1
@@ -162,7 +162,7 @@ class QuestBook(SignalMixin):
|
||||
|
||||
def add_quest(self, name: str) -> None:
|
||||
logger.info("Commencing quest: %s", name)
|
||||
self._quests = self._quests[-100:]
|
||||
self._quests = self._quests[-99:]
|
||||
self._quests.append(name)
|
||||
|
||||
|
||||
|
||||
@@ -146,3 +146,11 @@ def test_cinematic_text_matches_upstream() -> None:
|
||||
texts = [task.description for task in simulation.player.queue]
|
||||
assert any("You've reached the kind protection of " in t for t in texts)
|
||||
assert any(t.endswith("news!? -- Oh yes, of course") for t in texts)
|
||||
|
||||
|
||||
def test_quest_log_keeps_100_quests() -> None:
|
||||
quest_book = make_simulation().player.quest_book
|
||||
for i in range(150):
|
||||
quest_book.add_quest(f"quest {i}")
|
||||
assert len(quest_book.quests) == 100
|
||||
assert quest_book.quests[-1] == "quest 149"
|
||||
Reference in new issue
Block a user