Add dice-roll animation and tighten attack-roll prompt rules

Broadcast a "rolling" WS event when the DM invokes roll_dice, and show
a cycling dice-emoji animation with the roll notation in the chat while
waiting for the result, instead of just the generic typing indicator.

Also split the dice-roll prompt rule into skill/save checks (DC shown
to the player) vs. attack rolls (AC stays secret but must still be
labeled as a roll), and made the "always roll yourself, never ask the
player to roll" instruction unconditional.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Thorsten
2026-09-01 17:28:37 +02:00
parent 624644619c
commit 2b99451fdf
6 changed files with 62 additions and 11 deletions
+6 -1
View File
@@ -120,8 +120,13 @@ async def game_websocket(websocket: WebSocket, game_id: uuid.UUID, ticket: str)
)
await manager.broadcast(game_id, {"type": "typing"})
async def _broadcast_roll(notation: str) -> None:
await manager.broadcast(game_id, {"type": "rolling", "notation": notation})
try:
dm_message = await run_dm_turn(session, game_id, latest_player_message=content)
dm_message = await run_dm_turn(
session, game_id, latest_player_message=content, on_roll=_broadcast_roll
)
except Exception: # noqa: BLE001
logger.exception("DM turn failed for game %s", game_id)
await manager.broadcast(game_id, {"type": "error", "detail": "dm_turn_failed"})