mirror of
https://github.com/rr-/pq-cli.git
synced 2026-11-12 22:40:36 -07:00
mechanic: start acts as their loading task does
Upstream calls CompleteAct() when it dequeues the plot task, so the act number, the plot bar and the act rewards change as "Loading Act N" begins. pqcli did all that when the task ended. The random sequence is the same either way, so the parity traces are unchanged; only the 1-2 seconds of the loading task differ.
This commit is contained in:
2 files changed
+34
-23
No files matched your search
+9
-4
@@ -618,12 +618,17 @@ class Simulation:
|
|||||||
)
|
)
|
||||||
break
|
break
|
||||||
|
|
||||||
elif isinstance(self.player.task, PlotTask):
|
|
||||||
self.complete_act()
|
|
||||||
|
|
||||||
old = self.player.task
|
old = self.player.task
|
||||||
if self.player.queue:
|
if self.player.queue:
|
||||||
self.player.set_task(self.player.queue.pop(0))
|
task = self.player.queue.pop(0)
|
||||||
|
if isinstance(task, PlotTask):
|
||||||
|
# the act starts as its loading task does, as upstream
|
||||||
|
self.complete_act()
|
||||||
|
task = PlotTask(
|
||||||
|
f"Loading {act_name(self.player.quest_book.act)}",
|
||||||
|
task.duration,
|
||||||
|
)
|
||||||
|
self.player.set_task(task)
|
||||||
elif self.player.inventory.encum_bar.done:
|
elif self.player.inventory.encum_bar.done:
|
||||||
self.player.set_task(
|
self.player.set_task(
|
||||||
HeadingToMarketTask("Heading to market to sell loot", 4000)
|
HeadingToMarketTask("Heading to market to sell loot", 4000)
|
||||||
|
|||||||
+25
-19
@@ -167,30 +167,36 @@ def test_quest_log_keeps_100_quests() -> None:
|
|||||||
|
|
||||||
|
|
||||||
def test_prologue_fills_plot_bar() -> None:
|
def test_prologue_fills_plot_bar() -> None:
|
||||||
# upstream advances the plot bar on any task while act == 0
|
# upstream advances the plot bar on any task while act == 0, and starts
|
||||||
random.seed("prologue")
|
# act I as its loading task starts
|
||||||
simulation = make_simulation()
|
simulation = make_simulation()
|
||||||
player = simulation.player
|
player = simulation.player
|
||||||
positions = []
|
seen: list[tuple[str, float, int, int]] = []
|
||||||
player.connect(
|
|
||||||
"new_task",
|
def record() -> None:
|
||||||
lambda: positions.append(
|
assert player.task is not None
|
||||||
(player.task.description, player.quest_book.plot_bar.position)
|
bar = player.quest_book.plot_bar
|
||||||
),
|
seen.append(
|
||||||
|
(
|
||||||
|
player.task.description,
|
||||||
|
bar.position,
|
||||||
|
bar.max_,
|
||||||
|
player.quest_book.act,
|
||||||
)
|
)
|
||||||
while player.quest_book.act == 0:
|
)
|
||||||
|
|
||||||
|
player.connect("new_task", record)
|
||||||
|
while len(seen) < 7:
|
||||||
simulation.tick(100000.0)
|
simulation.tick(100000.0)
|
||||||
assert player.quest_book.plot_bar.max_ != 26 # reset by act I
|
assert [(position, act) for _, position, _, act in seen[:5]] == [
|
||||||
assert [position for _, position in positions[:6]] == [
|
(0, 0),
|
||||||
0,
|
(0, 0),
|
||||||
0,
|
(10, 0),
|
||||||
10,
|
(16, 0),
|
||||||
16,
|
(22, 0),
|
||||||
22,
|
|
||||||
26,
|
|
||||||
]
|
]
|
||||||
assert positions[5][0] == "Loading Act I"
|
assert seen[5] == ("Loading Act I", 0, 21600, 1)
|
||||||
assert positions[6][0] == "Heading to the killing fields"
|
assert seen[6][0] == "Heading to the killing fields"
|
||||||
|
|
||||||
|
|
||||||
def test_player_rng_survives_save_and_load() -> None:
|
def test_player_rng_survives_save_and_load() -> None:
|
||||||
|
|||||||
Reference in new issue
Block a user