Dungeons wait for the leader to start

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-25 19:21:37 +00:00
parent e43611e618
commit cf91cbce3c
4 changed files with 60 additions and 15 deletions

View file

@ -884,6 +884,7 @@ class DungeonTest(unittest.TestCase):
self.online(T0 + 600)
self.assertNotIn("fight", self.wil["action"]) # alone, it waits
self.assertIsNone(game.join_fight(self.world, self.kay, "wil", T0 + 600))
self.assertIsNone(game.start_run(self.world, self.wil, T0 + 600))
names = []
now = T0 + 600
while game.party_of(self.world, self.wil):
@ -901,21 +902,36 @@ class DungeonTest(unittest.TestCase):
self.assertGreaterEqual(p["gold"], game.DUNGEONS["dungeon_watchtower"]["bonus_gold"])
self.assertIn("cleared Watchtower Depths", self.world["ledger"][-1]["text"])
def test_joining_only_before_the_first_pull_and_up_to_four(self):
def test_a_group_waits_for_its_leader_and_holds_four(self):
game.start_action(self.world, self.wil, "dungeon_watchtower", T0)
self.assertIsNone(game.join_fight(self.world, self.kay, "wil", T0))
self.online(T0 + 1)
self.assertIsNone(game.join_fight(self.world, self.ann, "wil", T0 + 1)) # still resting: in time
self.party()["run"]["pull"] = 1
self.online(T0 + 600)
self.assertIsNone(self.party()["fight"]) # two in: still waiting for more
self.assertFalse(game.run_of(self.world, self.kay)["started"])
self.assertIsNone(game.join_fight(self.world, self.ann, "wil", T0 + 600))
extra = game.new_player("bo", "Bo", "ranger", T0)
extra["xp"]["combat"] = game.XP_TABLE[60]
self.world["players"]["bo"] = extra
self.assertEqual(game.join_fight(self.world, extra, "wil", T0 + 2), "The run has started")
self.assertIsNone(game.join_fight(self.world, extra, "wil", T0 + 600))
self.assertEqual(len(self.party()["members"]), 4)
self.assertFalse(game.joinable(self.world, self.wil))
self.assertEqual(game.start_run(self.world, self.kay, T0 + 601), "Only the leader starts")
self.assertIsNone(game.start_run(self.world, self.wil, T0 + 601))
self.online(T0 + 602)
self.assertEqual(len(self.party()["fight"]["members"]), 4)
game.leave_party(self.world, extra, self.party()["id"], T0 + 603)
extra["action"] = None
self.assertFalse(game.joinable(self.world, self.wil))
self.assertEqual(game.join_fight(self.world, extra, "wil", T0 + 604), "The run has started")
def test_no_run_alone(self):
game.start_action(self.world, self.wil, "dungeon_watchtower", T0)
self.assertEqual(game.start_run(self.world, self.wil, T0), "Not in a dungeon")
def test_a_run_waits_for_whoever_looked_away(self):
game.start_action(self.world, self.wil, "dungeon_watchtower", T0)
game.join_fight(self.world, self.kay, "wil", T0)
game.start_run(self.world, self.wil, T0)
self.online(T0 + 300, [self.wil]) # kay went to make tea
self.online(T0 + 1200, [self.wil])
self.assertIsNone(self.party()["fight"])
@ -940,6 +956,7 @@ class DungeonTest(unittest.TestCase):
def test_the_leader_can_pull_early(self):
game.start_action(self.world, self.wil, "dungeon_watchtower", T0)
game.join_fight(self.world, self.kay, "wil", T0)
game.start_run(self.world, self.wil, T0)
self.kay["hp"] = 1
self.online(T0 + 0.5)
fight = self.party()["fight"]