mirror of
https://github.com/rr-/pq-cli.git
synced 2026-11-12 22:40:36 -07:00
mechanic: fill the plot bar during the Prologue
This commit is contained in:
2 files changed
+40
-2
No files matched your search
+13
-2
@@ -332,6 +332,10 @@ class PlotTask(RegularTask):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class LoadingTask(RegularTask):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Player(SignalMixin):
|
class Player(SignalMixin):
|
||||||
signals = ["new_task", "level_up"]
|
signals = ["new_task", "level_up"]
|
||||||
|
|
||||||
@@ -493,7 +497,7 @@ class Simulation:
|
|||||||
self.player.elapsed += elapsed
|
self.player.elapsed += elapsed
|
||||||
|
|
||||||
if self.player.task is None:
|
if self.player.task is None:
|
||||||
self.player.set_task(RegularTask("Loading", 2000))
|
self.player.set_task(LoadingTask("Loading", 2000))
|
||||||
self.player.queue += [
|
self.player.queue += [
|
||||||
RegularTask(
|
RegularTask(
|
||||||
"Experiencing an enigmatic and foreboding night vision",
|
"Experiencing an enigmatic and foreboding night vision",
|
||||||
@@ -516,7 +520,7 @@ class Simulation:
|
|||||||
),
|
),
|
||||||
PlotTask(f"Loading {act_name(1)}", 2000),
|
PlotTask(f"Loading {act_name(1)}", 2000),
|
||||||
]
|
]
|
||||||
self.player.quest_book.plot_bar.reset(28)
|
self.player.quest_book.plot_bar.reset(26)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.player.task_bar.done:
|
if not self.player.task_bar.done:
|
||||||
@@ -551,6 +555,13 @@ class Simulation:
|
|||||||
self.player.quest_book.plot_bar.increment(
|
self.player.quest_book.plot_bar.increment(
|
||||||
self.player.task_bar.max_ / 1000
|
self.player.task_bar.max_ / 1000
|
||||||
)
|
)
|
||||||
|
elif self.player.quest_book.act == 0 and not isinstance(
|
||||||
|
self.player.task, (LoadingTask, PlotTask)
|
||||||
|
):
|
||||||
|
# the Prologue story tasks fill the plot bar
|
||||||
|
self.player.quest_book.plot_bar.increment(
|
||||||
|
self.player.task_bar.max_ / 1000
|
||||||
|
)
|
||||||
|
|
||||||
self.dequeue()
|
self.dequeue()
|
||||||
|
|
||||||
|
|||||||
@@ -154,3 +154,30 @@ def test_quest_log_keeps_100_quests() -> None:
|
|||||||
quest_book.add_quest(f"quest {i}")
|
quest_book.add_quest(f"quest {i}")
|
||||||
assert len(quest_book.quests) == 100
|
assert len(quest_book.quests) == 100
|
||||||
assert quest_book.quests[-1] == "quest 149"
|
assert quest_book.quests[-1] == "quest 149"
|
||||||
|
|
||||||
|
|
||||||
|
def test_prologue_fills_plot_bar() -> None:
|
||||||
|
# upstream advances the plot bar on any task while act == 0
|
||||||
|
random.seed("prologue")
|
||||||
|
simulation = make_simulation()
|
||||||
|
player = simulation.player
|
||||||
|
positions = []
|
||||||
|
player.connect(
|
||||||
|
"new_task",
|
||||||
|
lambda: positions.append(
|
||||||
|
(player.task.description, player.quest_book.plot_bar.position)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
while player.quest_book.act == 0:
|
||||||
|
simulation.tick(100000.0)
|
||||||
|
assert player.quest_book.plot_bar.max_ != 26 # reset by act I
|
||||||
|
assert [position for _, position in positions[:6]] == [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
10,
|
||||||
|
16,
|
||||||
|
22,
|
||||||
|
26,
|
||||||
|
]
|
||||||
|
assert positions[5][0] == "Loading Act I"
|
||||||
|
assert positions[6][0] == "Heading to the killing fields"
|
||||||
Reference in new issue
Block a user