Active play and the Watchtower Depths dungeon

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-10-24 12:05:23 +01:00
parent db1a00e8aa
commit 9d61de2012
9 changed files with 790 additions and 56 deletions

14
app.py
View file

@ -126,6 +126,9 @@ def player_view(world: dict, player: dict, now: float) -> dict:
view["action"] = {**player["action"], "growing": action["id"], "duration": duration}
if action.get("together") and not fight:
view["action"]["waiting"] = True # for a group: nothing to count down
run = game.run_of(world, player)
if run:
view["action"]["run"] = run
if fight:
view["action"]["fight"] = game.fight_view(fight)
party = game.party_of(world, player)
@ -288,6 +291,7 @@ class Handler(BaseHTTPRequestHandler):
summary = game.take_summary(player, game.empty_summary())
game.regen(world, player, now)
player["last_active"] = now
game.watch_fight(world, player, now) # looking at it: your manual abilities hold
self.store.save()
self.send_json(self.state(uid, summary))
elif path.startswith("/api/"):
@ -319,6 +323,7 @@ class Handler(BaseHTTPRequestHandler):
summary = game.take_summary(player, game.empty_summary())
game.regen(world, player, now)
player["last_active"] = now
game.watch_fight(world, player, now)
error = self.player_route(path, player, body, now)
if error is None:
game.process_player(world, player, now, self.store.rng) # a new fight is drawn up at once
@ -347,6 +352,15 @@ class Handler(BaseHTTPRequestHandler):
return game.start_action(world, player, str(body.get("id")), now, once=bool(body.get("once")))
if path == "/api/join":
return game.join_fight(world, player, str(body.get("id")), now)
if path == "/api/press":
target = body.get("target")
return game.press(world, player, str(body.get("id")), now, str(target) if target else None)
if path == "/api/target":
return game.set_fight_target(world, player, str(body.get("id")), now)
if path == "/api/pull":
return game.pull_now(world, player, now)
if path == "/api/manual":
return game.set_manual(world, player, str(body.get("id")), bool(body.get("on")), now)
if path == "/api/order":
return game.post_order(world, player, body.get("kind"), str(item), qty, body.get("provide"),
body.get("reward"), now)