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:
@@ -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"})
|
||||
|
||||
Reference in New Issue
Block a user