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
+5 -1
View File
@@ -20,6 +20,7 @@ export default function GameSession() {
const [selectedCharacterId, setSelectedCharacterId] = useState("");
const [joinError, setJoinError] = useState<string | null>(null);
const [isTyping, setIsTyping] = useState(false);
const [rollingNotation, setRollingNotation] = useState<string | null>(null);
async function loadGame() {
if (!gameId) return;
@@ -71,6 +72,7 @@ export default function GameSession() {
game?.is_participant ? gameId : undefined,
(incoming) => {
setIsTyping(false);
setRollingNotation(null);
setMessages((prev) => {
const next = [...prev, incoming];
return showingFull ? next : next.slice(-5);
@@ -78,6 +80,7 @@ export default function GameSession() {
},
(detail) => {
setIsTyping(false);
setRollingNotation(null);
const text =
detail === "connection_lost"
? "Verbindung zum Server verloren. Bitte lade die Seite neu."
@@ -98,6 +101,7 @@ export default function GameSession() {
});
},
() => setIsTyping(true),
(notation) => setRollingNotation(notation),
);
async function handleSend(content: string) {
@@ -177,7 +181,7 @@ export default function GameSession() {
</div>
<div className="flex flex-1 flex-col overflow-hidden rounded-lg border border-slate-800 bg-slate-900">
<TranscriptPane messages={messages} typing={isTyping} />
<TranscriptPane messages={messages} typing={isTyping} rolling={rollingNotation} />
<SendMessageForm onSend={handleSend} />
</div>
</div>