[PR #8258] [MERGED] feat(roleplay): tint roll cards by outcome #8251

Closed
opened 2026-10-26 04:04:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8258
Author: @ylli-selmani
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @ylli-selmani

Base: staging ← Head: feat/roll-result-tone


📝 Commits (2)

  • 50e4361 feat(roleplay): tint roll cards by outcome
  • 5fe89fe fix(roleplay): keep the roll audience warning under its select

📊 Changes

11 files changed (+179 additions, -29 deletions)

View changed files

📝 packages/client/src/components/chat/ChatMessage.tsx (+7 -0)
📝 packages/client/src/components/chat/RoleplayCommandResults.tsx (+11 -2)
📝 packages/client/src/components/chat/RoleplayCommandsSettings.tsx (+22 -0)
📝 packages/client/src/components/dice/AnimatedDiceRoll.tsx (+6 -6)
📝 packages/client/src/components/dice/AnimatedSkillCheckResult.tsx (+2 -20)
➕ packages/client/src/components/dice/dice-tone.ts (+56 -0)
📝 packages/client/src/lib/dice-roll-result.ts (+2 -1)
📝 packages/client/src/localization/locales/en.json (+4 -0)
📝 packages/shared/src/types/chat.ts (+2 -0)
📝 packages/shared/src/types/game.ts (+2 -0)
➕ scripts/regressions/roll-result-tone.regression.ts (+65 -0)

📄 Description

Linked issue

Closes #8255

Why this change

  • When a Roleplay character rolls with a DC, the dice card always uses the chat's accent color. A missed roll (1d20+1 = 2 vs DC 12) looks exactly like a success, so the outcome is only in small text or the narration after it.
  • The skill-check card already tints the same dice card by outcome. The [roll:] card just never got a tone.

What changed

Shared tone (reuse, not a rebuild)

  • The skill-check card's Tone, TONE_ACCENT colors and tone choice move unchanged into components/dice/dice-tone.ts. AnimatedSkillCheckResult and the roll card both use it, so the same outcome looks the same on both. Precedent: AnimatedSkillCheckResult.tsx.
  • AnimatedDiceRoll takes an optional tone. An explicit accentColor still wins, so the skill-check card renders exactly as before.

Roll verdict

  • The card reads the server's success field, which roll_dice already returns whenever a DC is given. The client never recomputes total < dc, because systems differ (meet-or-beat, roll-under). A roll without a DC stays in the accent color.
  • DiceRollResult gains an optional success, and isDiceRollResult accepts it only as a boolean.

Per-chat setting

  • A new Roll result colors select sits under "Who can roll dice" (Chat Settings → Agents → Commands → Rolls). It copies that select's markup. Options:
    • Off
    • Success and failure (default, for existing chats too)
    • Success, failure and criticals
  • Crits are opt-in, since not every table plays nat 1 / nat 20 rules. They apply only to a single die with known sides. A natural max is gold, a natural 1 is deep red, and a crit overrides the total, as on the skill-check card.

Proof

  • scripts/regressions/roll-result-tone.regression.ts covers:
    • each mode
    • no verdict means no tone
    • a crit overriding a passing total
    • multi-die and unknown-sides rolls never crit
    • the skill-check tones are unchanged
    • the guard rejects a non-boolean success

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Manually verify in the browser that in a Roleplay chat with Rolls on, the new "Roll result colors" select appears under "Who can roll dice" and defaults to "Success and failure".
  • Manually verify that a DC roll that passes renders green and one that misses renders red, and a roll without a DC keeps the accent color.
  • Manually verify that with "Success, failure and criticals", a nat 20 on a single d20 renders gold and a nat 1 renders deep red, and that switching back to "Success and failure" returns them to green/red.
  • Manually verify that "Off" restores the accent color on every roll card.
  • Manually verify that skill-check cards look unchanged.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Screenshot 2026-10-24 232348 image

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8258 **Author:** [@ylli-selmani](https://github.com/ylli-selmani) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ylli-selmani](https://github.com/ylli-selmani) **Base:** `staging` ← **Head:** `feat/roll-result-tone` --- ### 📝 Commits (2) - [`50e4361`](https://github.com/Pasta-Devs/Marinara-Engine/commit/50e436157d76ecc210da2d5cd280e8ea966ba910) feat(roleplay): tint roll cards by outcome - [`5fe89fe`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5fe89fe80e8ad12d3e4dba109885d2a2321a9637) fix(roleplay): keep the roll audience warning under its select ### 📊 Changes **11 files changed** (+179 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+7 -0) 📝 `packages/client/src/components/chat/RoleplayCommandResults.tsx` (+11 -2) 📝 `packages/client/src/components/chat/RoleplayCommandsSettings.tsx` (+22 -0) 📝 `packages/client/src/components/dice/AnimatedDiceRoll.tsx` (+6 -6) 📝 `packages/client/src/components/dice/AnimatedSkillCheckResult.tsx` (+2 -20) ➕ `packages/client/src/components/dice/dice-tone.ts` (+56 -0) 📝 `packages/client/src/lib/dice-roll-result.ts` (+2 -1) 📝 `packages/client/src/localization/locales/en.json` (+4 -0) 📝 `packages/shared/src/types/chat.ts` (+2 -0) 📝 `packages/shared/src/types/game.ts` (+2 -0) ➕ `scripts/regressions/roll-result-tone.regression.ts` (+65 -0) </details> ### 📄 Description ## Linked issue Closes #8255 ## Why this change - When a Roleplay character rolls with a DC, the dice card always uses the chat's accent color. A missed roll (`1d20+1 = 2` vs DC 12) looks exactly like a success, so the outcome is only in small text or the narration after it. - The skill-check card already tints the same dice card by outcome. The `[roll:]` card just never got a tone. ## What changed **Shared tone (reuse, not a rebuild)** - The skill-check card's `Tone`, `TONE_ACCENT` colors and tone choice move unchanged into `components/dice/dice-tone.ts`. `AnimatedSkillCheckResult` and the roll card both use it, so the same outcome looks the same on both. Precedent: `AnimatedSkillCheckResult.tsx`. - `AnimatedDiceRoll` takes an optional `tone`. An explicit `accentColor` still wins, so the skill-check card renders exactly as before. **Roll verdict** - The card reads the server's `success` field, which `roll_dice` already returns whenever a DC is given. The client never recomputes `total < dc`, because systems differ (meet-or-beat, roll-under). A roll without a DC stays in the accent color. - `DiceRollResult` gains an optional `success`, and `isDiceRollResult` accepts it only as a boolean. **Per-chat setting** - A new **Roll result colors** select sits under "Who can roll dice" (Chat Settings → Agents → Commands → Rolls). It copies that select's markup. Options: - Off - Success and failure (default, for existing chats too) - Success, failure and criticals - Crits are opt-in, since not every table plays nat 1 / nat 20 rules. They apply only to a single die with known sides. A natural max is gold, a natural 1 is deep red, and a crit overrides the total, as on the skill-check card. **Proof** - `scripts/regressions/roll-result-tone.regression.ts` covers: - each mode - no verdict means no tone - a crit overriding a passing total - multi-die and unknown-sides rolls never crit - the skill-check tones are unchanged - the guard rejects a non-boolean `success` ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Manually verify in the browser that in a Roleplay chat with Rolls on, the new "Roll result colors" select appears under "Who can roll dice" and defaults to "Success and failure". - Manually verify that a DC roll that passes renders green and one that misses renders red, and a roll without a DC keeps the accent color. - Manually verify that with "Success, failure and criticals", a nat 20 on a single d20 renders gold and a nat 1 renders deep red, and that switching back to "Success and failure" returns them to green/red. - Manually verify that "Off" restores the accent color on every roll card. - Manually verify that skill-check cards look unchanged. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) <img width="345" height="830" alt="Screenshot 2026-10-24 232348" src="https://github.com/user-attachments/assets/84838ce7-315f-4e2f-9d6c-fd5b2994a8e7" /> <img width="365" height="465" alt="image" src="https://github.com/user-attachments/assets/5e5916cd-29f8-433e-9257-8adf80392e77" /> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-26 04:04:06 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8251
No description provided.